Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / December 2007

Tip: Looking for answers? Try searching our database.

The import org.jdesktop cannot be resolved

Thread view: 
vlenin66 - 29 Dec 2007 10:31 GMT
I work on linux.
I have in /usr/local/netbeans-6.0/platform7/modules
the file org-jdesktop-layout.jar

When I try:
$ javac -classpath /usr/local/netbeans-6.0/platform7/modules/org-
jdesktop-layout.jar j*/*.java

it fails:
1. ERROR in javaapplication2/NewJFrame.java (at line 8)
import org.jdesktop.layout.*;
^^^^^^^^^^^^
The import org.jdesktop cannot be resolved
(javaapplication2/NewJFrame.java is a netbeans frame, and I can
compile it
from inside netbeans perfectly, but I can not compile it using javac
from command
line. That is the goal).

I also tried to copy /usr/local/netbeans-6.0/platform7/modules/org-
jdesktop-layout.jar
into /usr/lib/jvm/java-1.5.0-sun-1.5.0.10/jre/lib and /usr/lib/jvm/
java-1.5.0-sun-1.5.0.10/jre/lib/ext,
that dod not help.

What can I do to get it resolved?

Thanks!
Lew - 29 Dec 2007 15:37 GMT
> I work on linux.
> I have in /usr/local/netbeans-6.0/platform7/modules
[quoted text clipped - 22 lines]
>
> What can I do to get it resolved?

$ jar tf $NETBEANS_HOME/platform7/modules/org-jdesktop-layout.jar
META-INF/
META-INF/MANIFEST.MF
org/
org/netbeans/
org/netbeans/libs/
org/netbeans/libs/layoutext/
org/netbeans/libs/layoutext/Bundle.properties

No sign that org.jdesktop.layout is in there.  Maybe if you read the
MANIFEST.MF you'll discover that the layout manager is actually in
$NETBEANS_HOME/platform7/modules/ext/swing-layout-1.0.3.jar.

It doesn't do much good to copy a JAR without the JARs on which it depends.

Signature

Lew

Lew - 29 Dec 2007 15:40 GMT
vlenin66 wrote:
>> I also tried to copy /usr/local/netbeans-6.0/platform7/modules/org-
>> jdesktop-layout.jar
>> into /usr/lib/jvm/java-1.5.0-sun-1.5.0.10/jre/lib and /usr/lib/jvm/
>> java-1.5.0-sun-1.5.0.10/jre/lib/ext,
>> that dod not help.

For God's sake, don't put your crap into the JVM lib/ directory, and avoid
like heck putting it into the extensions.

You should upgrade your Java.  There was a security patch since that version -
I think update 11 is the first of the Java 5s to get it.  How come you're not
using Java 6?

Signature

Lew

vlenin66 - 29 Dec 2007 20:00 GMT
> vlenin66 wrote:
> >> I also tried to copy /usr/local/netbeans-6.0/platform7/modules/org-
[quoted text clipped - 5 lines]
> For God's sake, don't put your crap into the JVM lib/ directory, and avoid
> like heck putting it into the extensions.

For Mysql connection that was the solution: I put my crap into JVM,and
voila, mysql worked.

> You should upgrade your Java.  There was a security patch since that version -
> I think update 11 is the first of the Java 5s to get it.  How come you're not
> using Java 6?
>
> --
> Lew
I use linstalled knoppix, and it delivers java 1.5. I'd like to get
this work with java 1.5.
I do not want to install anything new, since the given java program
works well with netbeans.
The goal is, to get it work from command line.

Thanks!
Lew - 29 Dec 2007 21:32 GMT
Lew wrote:
>> For God's sake, don't put your crap into the JVM lib/ directory, and avoid
>> like heck putting it into the extensions.

> For Mysql connection that was the solution: I put my crap into JVM,and
> voila, mysql worked.

Actually, that was most definitely not "the solution" but a maintenance
nightmare a-borning.  It was a workaround, and may have suppressed your
symptoms, but it was no more a cure than aspirin is a cure for the flu even
when it gets rid of the headache.

Putting custom JARs in the JVM itself is bad.  Putting them in the extensions
directories is dangerous, and often bad unless the practitioner fully
understands the consequences.  Neither is really ever necessary - extensions
directories exist so that you can, in effect, expand the Java language itself.
 Normal library references are better managed by using the classpath.

In any event, you put the wrong JAR in there, so extensions, JVM lib/ or
classpath doesn't matter.

Please study the matter and learn why it's bad to put things in the JVM lib/
or extensions directories without full understanding.

Signature

Lew

vlenin66 - 29 Dec 2007 19:55 GMT
> > I work on linux.
> > I have in /usr/local/netbeans-6.0/platform7/modules
[quoted text clipped - 40 lines]
> --
> Lew

Lew, thanks for the reply.
It still does not work:
en@gepem:~/NetBeansProjects/JavaApplication2/src$ javac -classpath /
usr/local/netbeans-6.0/platform7/modules/ext/swing-layout-1.0.3.jar j*/
*.java
----------
1. ERROR in javaapplication2/NewJFrame.java (at line 8)
       import org.jdesktop.layout.*;
              ^^^^^^^^^^^^
The import org.jdesktop cannot be resolved

swing-layout-1.0.3.jar shows org.jdesktop.layout using Ark.

Thanks!
Lew - 29 Dec 2007 21:39 GMT
> It still does not work:
> en@gepem:~/NetBeansProjects/JavaApplication2/src$ javac -classpath /
[quoted text clipped - 7 lines]
>
> swing-layout-1.0.3.jar shows org.jdesktop.layout using Ark.

I'm going to assume that the line breaks in your posted command do not
correspond to whitespace in the actual command line.

It sure looks mysterious based on the information you have provided so far.

Would you post the top part of your javaapplication2/NewJFrame.java source,
from the top through the "class" declaration line?

Signature

Lew

vlenin66 - 29 Dec 2007 21:23 GMT
..

I found in the mean time, that Kaffe was also installed. If I use
originaljava/javac, I can compile. Now the problem looks: HelloWorld
works fine, gui compiles, but fails with class not found.

Here the details:

HelloWorld program
--------------------

compile:
-------
en@gepem:~/NetBeansProjects/JavaApplication2/src$ /usr/lib/jvm/
java-1.5.0-sun-1.5.0.10/bin/javac -cp /usr/local/netbeans-6.0/
platform7/modules/ext/swing-layout-1.0.3.jar javaapplication2/
Main.java

Run
----
en@gepem:~/NetBeansProjects/JavaApplication2/src$ /usr/lib/jvm/
java-1.5.0-sun-1.5.0.10/bin/java javaapplication2.Main
Hello Hattyú

Hello ClassNotFound with swing layout classpath:
-------------------------------------------------

en@gepem:~/NetBeansProjects/JavaApplication2/src$ java -cp /usr/local/
netbeans-6.0/platform7/modules/ext/swing-layout-1.0.3.jar
javaapplication2.Main
Exception in thread "main" java.lang.NoClassDefFoundError:
javaapplication2/Main

GUI compiles:
-------------

en@gepem:~/NetBeansProjects/JavaApplication2/src$ /usr/lib/jvm/
java-1.5.0-sun-1.5.0.10/bin/javac -cp /usr/local/netbeans-6.0/
platform7/modules/ext/swing-layout-1.0.3.jar javaapplication2/
NewJFrame.java

Gui ClassNoFound with swing layout:
-----------------------------------

en@gepem:~/NetBeansProjects/JavaApplication2/src$ /usr/lib/jvm/
java-1.5.0-sun-1.5.0.10/bin/java -cp /usr/local/netbeans-6.0/platform7/
modules/ext/swing-layout-1.0.3.jar javaapplication2.NewJFrame
Exception in thread "main" java.lang.NoClassDefFoundError:
javaapplication2/NewJFrame
en@gepem:~/NetBeansProjects/JavaApplication2/src$

Gui ClassNoFound with swing layout:
-----------------------------------

en@gepem:~/NetBeansProjects/JavaApplication2/src$ /usr/lib/jvm/
java-1.5.0-sun-1.5.0.10/bin/java  javaapplication2.NewJFrame
Exception in thread "main" java.lang.NoClassDefFoundError: org/
jdesktop/layout/GroupLayout$Group

Thanks in advance!
Lew - 29 Dec 2007 21:45 GMT
> Hello ClassNotFound with swing layout classpath:
> -------------------------------------------------
[quoted text clipped - 4 lines]
> Exception in thread "main" java.lang.NoClassDefFoundError:
> javaapplication2/Main

You need to add "." to the classpath.

> Gui ClassNoFound with swing layout:
> -----------------------------------
[quoted text clipped - 5 lines]
> javaapplication2/NewJFrame
> en@gepem:~/NetBeansProjects/JavaApplication2/src$

You need to add "." to the classpath.

> Gui ClassNoFound with swing layout:
> -----------------------------------
[quoted text clipped - 3 lines]
> Exception in thread "main" java.lang.NoClassDefFoundError: org/
> jdesktop/layout/GroupLayout$Group

You need to add the JAR and "." to the classpath.

Also, could you (at least temporarily) add the Java 'bin/' directory to your
PATH?  All this line wrapping makes your stuff really hard to decipher.

Signature

Lew

vlenin66 - 29 Dec 2007 21:29 GMT
Found the solution:
when I say:
java -cp /usr/local/netbeans-6.0/platform7/modules/ext/swing-
layout-1.0.3.jar:.:./javaapplication2 javaapplication2.NewJFrame

then gui works (also HelloWorld works like that).

Thanks for the help, Happy End. :-)
Lew - 29 Dec 2007 21:46 GMT
> Found the solution:
> when I say:
> java -cp /usr/local/netbeans-6.0/platform7/modules/ext/swing-
> layout-1.0.3.jar:.:./javaapplication2 javaapplication2.NewJFrame
>
> then gui works (also HelloWorld works like that).

'./javaapplication2' (or more simply, just 'javaapplication2') should not be
part of the classpath, because it's part of the package structure.

Signature

Lew



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.