LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-17-2012, 02:02 AM   #1
andrewpw
LQ Newbie
 
Registered: Feb 2012
Posts: 1

Rep: Reputation: Disabled
Why can't I run my Java program on the Ubuntu terminal


I installed java version 1.6.0_26 on Ubuntu. I can compile my java code, but when I try to run the program using "java Jsh" in the terminal command line, I get this.

Exception in thread "main" java.lang.NoClassDefFoundError: Jsh (wrong name: jsh/Jsh)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)

my program compiles and runs fine on eclipse, but won't load on the terminal. I tried a program my professor created on my terminal and it ran fine. Why doesn't mine work. I can post my code if needed. Thanks.

~andrewpw
 
Old 02-17-2012, 06:25 AM   #2
on.sid
LQ Newbie
 
Registered: Dec 2011
Posts: 10

Rep: Reputation: Disabled
I removed Java completely from my system, but I dare guesstimate the following.

1) You need to make sure that the CLASSPATH environment variable holds all locations where the project's class files are to be found.

2) If I remember correctly, Eclipse provides an export function for Java projects packing it together into a .jar file, which you can run with java -jar $file.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
start new terminal windows to run a new program ufmale Linux - Newbie 5 07-25-2007 09:11 AM
Trying to run a java program vmelkon Ubuntu 6 05-30-2007 06:05 AM
how do you run a program from terminal? fatbeaver Linux - Newbie 1 04-26-2006 12:41 PM
any way to continue using the terminal while any program is being run? g_srinivas Linux - Newbie 6 07-20-2005 08:30 AM
How to run a program on another terminal SharpyWarpy Linux - General 2 02-10-2005 02:09 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:00 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration