• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Quick Problem with Java...

x0lution

Member
I'm having one quick problem with java... I can compile my programs fine, but when I run them with the java interpreter, it gives me the message: Exception in thread "main" java.lang.NoClassDefFoundError: Java

here's the source...

public class Blah {
public static void main( String args[] )
{
System.out.println("Blah&quot😉;
}
}

What's going on here?
 
Did you import the java io classes? Is the name of your file Blah.java? It worked fine for me...

Contens of Blah.java:

import java.io.*;

public class Blah {

public static void main( String args[] ) {
System.out.println("Blah&quot😉;
}

}
 
I'm trying to setup java on a friend's computer. i never had to import the io files on my computer before so didn't do it here. And yes the file is named Blah.java.
 
Are you sure you are running like this (when you try executing the java program):

>java Blah

and not :

>java blah

or

>java Blah.class

or something like that. Only the first syntax is correct! Common mistake
that can be made.
Atleast from a quick glance that seems to be the problem.
 

import java.io.*;
public class Blah
{
public static void main( String args[] )
{
System.out.println("Blah&quot😉;
}
}


works for me

and

//import java.io.*;

public class Blah
{
public static void main( String args[] )
{
System.out.println("Blah&quot😉;
}
}


works for me too.

i use kawa IDE with jdk 1.3
 
I don't think there's any problem with the code. The original code
(without any Import-statements) worked fine when I tried it.
I still think it's only a matter of passing the wrong argument to the
Java interpretor.

 
I am typing 'java Blah'...

What's setup in ya'lls autoexec.bat file? the only java related thing in mine is 'path=c:\jdk1.3\bin'. Am I missing something
 
it's been about a month since this thread was updated, but during that time I've figured out what the problem was...

the CLASSPATH variable on the machine I was using was set for some other program (Adobe I think)... just add a semicolon and a period behind that and it sets the classpath to look in the current directory as well, and that has fixed the problem.
 
Back
Top