java.lang.NoClassDefFoundError Please Help

Using the Java SDK with TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

jgn1013
Posts: 2
Joined: Tue Apr 06, 2004 8:43 pm

Post by jgn1013 »

s_reynisson..

I have the latest TP and i've tried setting it up with JAVA_HOME
%JAVA_HOME/bin still no go. This is really frustrating!! DOn't know what else to do. :evil: I've searched all over the internet and have not come up with a solution..nowonder why people use Microsoft .net solution.
User avatar
s_reynisson
Posts: 939
Joined: Tue May 06, 2003 1:59 pm

Post by s_reynisson »

Well, in Windows you use \ as a path seperator, hope it's just a typo. Agnul's "command path" is supposed to be %JAVA_HOME%\bin for Windows. If you have set the JAVA_HOME variable that is.

Currently I'm using J2SE 1.5.0 Beta 1 with TP 4.7.2 with both on default settings, I added nothing manually to the TP setup, the Java setup, the path or system variables.

You could try starting "clean", uninstall all Java distros and TP from your system. Use some cleanup programs for the registry. Remove all Java related info from system variables and path. And start again.

Writing off Java because TP, JDK and Windows don't "sync" well on your system is a bit over the top, try other editors or even a diffrent Java SDK version.
Then I open up and see
the person fumbling here is me
a different way to be
Inverso
Posts: 1
Joined: Fri Apr 16, 2004 9:43 pm
Location: Portsmouth, UK
Contact:

Another Problem / Solution

Post by Inverso »

I found that I was also getting this error, and that reinstalling things and changing environment variables had no effect. However, when I changed my classname from "musicTranscriptionProgram" to "MTP", everything worked fine - so I assume classnames of over 8 characters in length cause a problem.

More details:
  • OS: Windows 2000
    JDK: 1.4.0-beta3
    Textpad: 4.7.2 (32 bit)
Hope that helps some of you :roll:
-=Jonny B=-
dhardy47
Posts: 1
Joined: Fri Jun 04, 2004 8:32 am

THANK YOU!

Post by dhardy47 »

:lol: Thank You Thank You Thank You!!!!!!!!!!!!!!!!!!!!!!

I have been pulling my hair out over this same problem for a week now. Thanks for the help everybody! :D :D :D
User avatar
talleyrand
Posts: 624
Joined: Mon Jul 21, 2003 6:56 pm
Location: Kansas City, MO, USA
Contact:

Post by talleyrand »

I must have missed this thread back in April but there is no issue with TextPad and Java and filenames > 8 characters. If anything, you'd have noticed an issue with the compiler since the DOS restriction was 8.3 which means your file name would have been musicTra.jav and the compiler (at least 1.4.1 and before) will not attempt to compile anything that doesn't end in a .java extension (feel free to try to compile anything with a .txt or .jav and see for yourself).

The following code is greater than the 8.3 restriction and compiles just fine on my system (TP 4.7.2, JVM 1.4.1_01, Win 2k). My path looks like the following but YMMV
PATH=E:\Python23\.;E:\texmf\miktex\bin;E:\cygwin\bin;E:\Perl\bin\;C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem;F:\Python;e:\vim\vim60;E:\j2sdk1.4.1_01\bin;"C:\Program Files\Internet Explorer";C:\Program Files\Microsoft SQL Server\80\Tools\BINN;e:\nmap-3.45;"e:\program files\textpad 4";E:\Python23\Lib\site-packages\wxPython\tools\boa;.

Code: Select all

F:\java>type TestStatement.java
import java.lang.reflect.Method;

public class TestStatement
{
        public static void main(String[] args)
        {
                System.out.println("Calling method from another class:");
                //SetUpSite.statementOfPhilsophy();

                String className = "SetUpSite";
                try
                {
                        Class c = Class.forName(className);

                        Method [] m = c.getDeclaredMethods();
                        for (int i = 0; i < m.length; i += 1)
                                System.out.println(m[i]);
                }
                catch (ClassNotFoundException ex)
                {
                        System.out.println("Class not found " + className);
                }

        }
}
What I'd have suggested is that you verify that the current working directory in your path and that the file name exactly matches the class name (and to follow the Sun naming convention and Pascal-case your class/file so that it is MusicTranscriptionProgram). If it still fails, then I'd suggest you post your code and have another set of eyes examine it.
I choose to fight with a sack of angry cats.
Big E
Posts: 1
Joined: Wed Jan 26, 2005 4:29 am
Location: Chicago

Holy BatShiite Billy!

Post by Big E »

I FINALLY sorted out the problems I was having - what a pain

OK - if you're like me, and semi-catatonic after staring at code, or troubleshoooting after say 6 hours - I've got your answer.

FIRST AND FOREMOST: I checked and rechecked my classpath variable. In win xp, right click my computer -> properties -> advanced -> Enviornmental Variables -> edit your classpath variable to add the ;. - just like it says in countelss posts in this forum.

HOWEVER _ DO NOT DO WHAT I DID - my path already existed, but pointed not into the bin directory (in mycase C:\Sun\AppServer\jdk\bin) but was pointing into a lib directory. That am bad. Change it. THEN add your ;. to the classpath. My classpath currently looks like this: C:\Sun\AppServer\jdk\bin;.

OKAY - SOOOOOOOO

This is another option I just tried as well.... I specified my additional classpath (".") in the paramaters field for the Java compiler... the -d "." segment below specifies to place the compiled class in the current directory... with my bad classpath in my environmental variable (as I stated before) this was hosing up everything for me ( I assume)

This is my my textpad configuration now, and everything finally works:

Under The Configure-> preferences -> tools-> , these are how my fields look now:

Compile Java:
Paramaters: $File -classpath "." -d "."
Initial Folder: $FileDir


Run Java Application:
Paramaters: $BaseName
Initial Folder: $FileDir

so - as long as your java files are in the bin, everything runs okay - still working on how to get them to run ( so that the Java and javac files can be located) outside the bin.
Big E
Post Reply