Java execute error in Linux  
Author Message
Stefan Schulz





PostPosted: 2005-10-24 1:54:00 Top

java-programmer, Java execute error in Linux On Sun, 23 Oct 2005 16:57:56 +0000, Peter Jones wrote:

> Hello all,
> I'm having a problem resolving an error that I keep getting when
> I try to execute a peice of java code. Im using Debian 3.1r0a.
>
> Here's the lo-down. The code is wrtten and complete, no syntax errors at
> all. In fact, it compiles fine. The problem is when I try to execute the
> code. The screenshot says it all. There is no code behind the terminal
> box (where the errors are being displayed). The code you see there is
> really as simple as it looks. Any ideas? I'm open to any suggestions.
> I'm running SableVM, but that hasn't helped.

Two things to remember:

1) Do not post binary articles to a non-binary group. Hint, this is a
non-binary group.

2) Post your questions into the appropriate newsgroup. For beginners
questions, this would be comp.lang.java.help

--
You can't run away forever,
But there's nothing wrong with getting a good head start.
--- Jim Steinman, "Rock and Roll Dreams Come Through"


 
Peter Jones





PostPosted: 2005-10-24 3:43:00 Top

java-programmer >> Java execute error in Linux Stefan Schulz wrote:
> On Sun, 23 Oct 2005 16:57:56 +0000, Peter Jones wrote:
>
>
>>Hello all,
>> I'm having a problem resolving an error that I keep getting when
>>I try to execute a peice of java code. Im using Debian 3.1r0a.
>>
>>Here's the lo-down. The code is wrtten and complete, no syntax errors at
>>all. In fact, it compiles fine. The problem is when I try to execute the
>>code. The screenshot says it all. There is no code behind the terminal
>>box (where the errors are being displayed). The code you see there is
>>really as simple as it looks. Any ideas? I'm open to any suggestions.
>>I'm running SableVM, but that hasn't helped.
>
>
> Two things to remember:
>
> 1) Do not post binary articles to a non-binary group. Hint, this is a
> non-binary group.
>
> 2) Post your questions into the appropriate newsgroup. For beginners
> questions, this would be comp.lang.java.help
>
Your opinions are appreciated. However, this is not a "beginner"
question, in the sense that my programming skills are more than adequate
to compose a succesful bug free piece of code. The code is only simple
because it was the first port (one of many) to the GNU/Linux operating
system. Also this was an execution error, and so may be to do with the
nature of the java libraries installed on the machine, and not some
buggy code. Your directions will be noted.
Again, many thanks.
 
Roedy Green





PostPosted: 2005-10-24 5:59:00 Top

java-programmer >> Java execute error in Linux On Sun, 23 Oct 2005 16:57:56 +0000 (UTC), Peter Jones
<email***@***.com> wrote or quoted :

> The screenshot says it all.

It gives precious few clues. See
http://mindprod.com/jgloss/runerrormessages.html#CLASSNOTFOUNDEXCEPTION
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.
 
 
Roedy Green





PostPosted: 2005-10-24 6:18:00 Top

java-programmer >> Java execute error in Linux On Sun, 23 Oct 2005 19:44:04 +0000 (UTC), Peter Jones
<email***@***.com> wrote or quoted :

> I'm having a problem resolving an error that I keep getting when
>I try to execute a peice of java code. Im using Debian 3.1r0a.

see http://mindprod.com/jgloss/multiposting.html
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.
 
 
Peter Jones





PostPosted: 2005-10-24 6:52:00 Top

java-programmer >> Java execute error in Linux Roedy Green wrote:
> On Sun, 23 Oct 2005 19:44:04 +0000 (UTC), Peter Jones
> <email***@***.com> wrote or quoted :
>
>
>> I'm having a problem resolving an error that I keep getting when
>>I try to execute a peice of java code. Im using Debian 3.1r0a.
>
>
> see http://mindprod.com/jgloss/multiposting.html
Someone kindly replied to the original post pointing out that I may have
had posted in the wrong place. I'm sure you read that bit.
 
 
Roedy Green





PostPosted: 2005-10-24 6:56:00 Top

java-programmer >> Java execute error in Linux On Sun, 23 Oct 2005 22:51:40 +0000 (UTC), Peter Jones
<email***@***.com> wrote or quoted :

>>
>> see http://mindprod.com/jgloss/multiposting.html
>Someone kindly replied to the original post pointing out that I may have
>had posted in the wrong place. I'm sure you read that bit.

there are levels of sins in the comp.lang.java.* religion.

minor: posting to the wrong place. See
http://mindprod.com/jgloss/newsgroups.html

cardinal: crossposting see
http://mindprod.com/jgloss/crossposting.html

mortal: multiposting see
http://mindprod.com/jgloss/multiposting.html
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.
 
 
Peter Jones





PostPosted: 2005-10-24 19:20:00 Top

java-programmer >> Java execute error in Linux Roedy Green wrote:
> On Sun, 23 Oct 2005 22:51:40 +0000 (UTC), Peter Jones
> <email***@***.com> wrote or quoted :
>
>
>>>
>>>see http://mindprod.com/jgloss/multiposting.html
>>
>>Someone kindly replied to the original post pointing out that I may have
>>had posted in the wrong place. I'm sure you read that bit.
>
>
> there are levels of sins in the comp.lang.java.* religion.
>
> minor: posting to the wrong place. See
> http://mindprod.com/jgloss/newsgroups.html
>
> cardinal: crossposting see
> http://mindprod.com/jgloss/crossposting.html
>
> mortal: multiposting see
> http://mindprod.com/jgloss/multiposting.html
Thanks for letting me know.
 
 
Peter Jones





PostPosted: 2005-10-24 19:29:00 Top

java-programmer >> Java execute error in Linux Roedy Green wrote:

> On Sun, 23 Oct 2005 22:51:40 +0000 (UTC), Peter Jones
> <email***@***.com> wrote or quoted :
>
>
>>>
>>>see http://mindprod.com/jgloss/multiposting.html
>>
>>Someone kindly replied to the original post pointing out that I may have
>>had posted in the wrong place. I'm sure you read that bit.
>
>
> there are levels of sins in the comp.lang.java.* religion.
>
> minor: posting to the wrong place. See
> http://mindprod.com/jgloss/newsgroups.html
>
> cardinal: crossposting see
> http://mindprod.com/jgloss/crossposting.html
>
> mortal: multiposting see
> http://mindprod.com/jgloss/multiposting.html
Im also glad to hear you dont think Jesus is God. I hope your Muslim.
Regards.
 
 
Roedy Green





PostPosted: 2005-10-24 21:35:00 Top

java-programmer >> Java execute error in Linux On Mon, 24 Oct 2005 11:29:04 +0000 (UTC), Peter Jones
<email***@***.com> wrote, quoted or indirectly
quoted someone who said :

>Im also glad to hear you dont think Jesus is God. I hope your Muslim.
>Regards.

When I was a kid my Mom told me to avoid Christians. I was raised
atheist. So naturally I rebelled by sneaking out and going to
churches and interviewing people to try to find out what this god
stuff was about. I decided that none of the people in the churches
had the tiniest clue, and further were not really very interested.
They liked it all warm and fuzzy and did seemed to think it impolite
to peer too closely at their beliefs that they could not articulate.

I continued these explorations as an adult, hanging out with Buddhist
monks, various cults, Moslems, Wiccans, Jehovah's Witnesses etc.

I liked the Buddhists the best. They have the attitude, if you like
it fine, if you don't, take what you like and try something else. They
are more into investigating interesting mental phenomena than selling
you dogma or taking your money.

If you are curious about my thoughts on such matters there are two
branches of my website quite different from the Java glossary you
might want to dig into. Prepare to be offended if you are a
fundamentalist. These generate almost as much hate mail as the stuff
on the Iraq war.
See http://mindprod.com/religion/religion.html
http://mindprod.com/deepthoughts/deepthoughts.html
http://mindprod.com/politics/iraq.html






--
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.
 
 
Steve Horsley





PostPosted: 2005-10-25 3:51:00 Top

java-programmer >> Java execute error in Linux Peter Jones wrote:
> Hello all,
> I'm having a problem resolving an error that I keep getting when
> I try to execute a peice of java code. Im using Debian 3.1r0a.
>
> Here's the lo-down. The code is wrtten and complete, no syntax errors at
> all. In fact, it compiles fine. The problem is when I try to execute the
> code. The screenshot says it all. There is no code behind the terminal
> box (where the errors are being displayed). The code you see there is
> really as simple as it looks. Any ideas? I'm open to any suggestions.
> I'm running SableVM, but that hasn't helped.
>
> ------------------------------------------------------------------------
>

Try this:
$ cd ~/devel
$ java printout

I suspect the leading path is upsetting the classloader.
Something like this may also do the trick:

$ java -cp /home/anton/devel printout


Yup - just tried it at home, see below.

Steve



steve@StevesPC:~/devel$ /opt/jdk1.5.0_05/bin/javac printout.java
steve@StevesPC:~/devel$ java printout
Hello
steve@StevesPC:~/devel$ cd
steve@StevesPC:~$ java devel/printout
Exception in thread "main" java.lang.NoClassDefFoundError:
devel/printout (wrong name: printout)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at
java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at
java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native
Method)
at
java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at
java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
steve@StevesPC:~$ java -cp /home/steve/devel printout
Hello
steve@StevesPC:~$
 
 
Peter Jones





PostPosted: 2005-10-25 18:26:00 Top

java-programmer >> Java execute error in Linux Steve Horsley wrote:
> Peter Jones wrote:
>
>> Hello all,
>> I'm having a problem resolving an error that I keep getting
>> when I try to execute a peice of java code. Im using Debian 3.1r0a.
>>
>> Here's the lo-down. The code is wrtten and complete, no syntax errors
>> at all. In fact, it compiles fine. The problem is when I try to
>> execute the code. The screenshot says it all. There is no code behind
>> the terminal box (where the errors are being displayed). The code you
>> see there is really as simple as it looks. Any ideas? I'm open to any
>> suggestions.
>> I'm running SableVM, but that hasn't helped.
>>
>> ------------------------------------------------------------------------
>>
>
> Try this:
> $ cd ~/devel
> $ java printout
>
> I suspect the leading path is upsetting the classloader. Something like
> this may also do the trick:
>
> $ java -cp /home/anton/devel printout
>
>
> Yup - just tried it at home, see below.
>
> Steve
>
>
>
> steve@StevesPC:~/devel$ /opt/jdk1.5.0_05/bin/javac printout.java
> steve@StevesPC:~/devel$ java printout
> Hello
> steve@StevesPC:~/devel$ cd
> steve@StevesPC:~$ java devel/printout
> Exception in thread "main" java.lang.NoClassDefFoundError:
> devel/printout (wrong name: printout)
> at java.lang.ClassLoader.defineClass1(Native Method)
> at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
> at
> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
> at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
> at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
> at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
> at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
> steve@StevesPC:~$ java -cp /home/steve/devel printout
> Hello
> steve@StevesPC:~$
I will try it ASAP! Thanks very much for the helpful reply.
I will post back to let you know how it went.
 
 
Peter Jones





PostPosted: 2005-10-26 4:03:00 Top

java-programmer >> Java execute error in Linux Steve Horsley wrote:

> Peter Jones wrote:
>
>> Hello all,
>> I'm having a problem resolving an error that I keep getting
>> when I try to execute a peice of java code. Im using Debian 3.1r0a.
>>
>> Here's the lo-down. The code is wrtten and complete, no syntax errors
>> at all. In fact, it compiles fine. The problem is when I try to
>> execute the code. The screenshot says it all. There is no code behind
>> the terminal box (where the errors are being displayed). The code you
>> see there is really as simple as it looks. Any ideas? I'm open to any
>> suggestions.
>> I'm running SableVM, but that hasn't helped.
>>
>> ------------------------------------------------------------------------
>>
>
> Try this:
> $ cd ~/devel
> $ java printout
>
> I suspect the leading path is upsetting the classloader. Something like
> this may also do the trick:
>
> $ java -cp /home/anton/devel printout
>
>
> Yup - just tried it at home, see below.
>
> Steve
>
>
>
> steve@StevesPC:~/devel$ /opt/jdk1.5.0_05/bin/javac printout.java
> steve@StevesPC:~/devel$ java printout
> Hello
> steve@StevesPC:~/devel$ cd
> steve@StevesPC:~$ java devel/printout
> Exception in thread "main" java.lang.NoClassDefFoundError:
> devel/printout (wrong name: printout)
> at java.lang.ClassLoader.defineClass1(Native Method)
> at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
> at
> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
> at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
> at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
> at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
> at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
> steve@StevesPC:~$ java -cp /home/steve/devel printout
> Hello
> steve@StevesPC:~$
$ cd ~/devel
$ java printout
yep, this first solution worked, not sure how though.

Then I edited the commands in the Anjuta Preferences for handling Java
files, and that worked a treat. For some reason the Execute command
line, and compile line were backto front (i.e. execute command should
have been in the compile field and visa versa).
many thanks for the help, will post back how it goes later on.