Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 02-17-2012, 03:02 AM   #1
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(
at java.lang.ClassLoader.defineClass(
at Method)
at java.lang.ClassLoader.loadClass(
at sun.misc.Launcher$AppClassLoader.loadClass(
at java.lang.ClassLoader.loadClass(

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.

Old 02-17-2012, 07:25 AM   #2
LQ Newbie
Registered: Dec 2011
Distribution: aptosid
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.


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 10:11 AM
Trying to run a java program vmelkon Ubuntu 6 05-30-2007 07:05 AM
how do you run a program from terminal? fatbeaver Linux - Newbie 1 04-26-2006 01:41 PM
any way to continue using the terminal while any program is being run? g_srinivas Linux - Newbie 6 07-20-2005 09:30 AM
How to run a program on another terminal SharpyWarpy Linux - General 2 02-10-2005 03:09 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:27 PM.

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