Can I make .class files run like executable .jar files on a Windows platform?

  • Thread starter phillipedison1891
  • Start date
P

phillipedison1891

I have a friend who likes to send his Java creations to me by e-mail in
..class form. One problem, though: When I go to the command prompt and
type in java sampleProgram.class, it gives me a "NoClassDefFoundError".
I don't want to have to recompile the source code with NetBeans. How
can I make the source code run?
 
M

Malte

I have a friend who likes to send his Java creations to me by e-mail in
.class form. One problem, though: When I go to the command prompt and
type in java sampleProgram.class, it gives me a "NoClassDefFoundError".
I don't want to have to recompile the source code with NetBeans. How
can I make the source code run?

Try to leave out the .class part.
 
C

Collin VanDyck

You usually will type in

% java sampleProgram

If the file is called sampleProgram.class that he sent you. You should
not append .class to the end of the 'java' command.
 
M

Malte

I have a friend who likes to send his Java creations to me by e-mail in
.class form. One problem, though: When I go to the command prompt and
type in java sampleProgram.class, it gives me a "NoClassDefFoundError".
I don't want to have to recompile the source code with NetBeans. How
can I make the source code run?

Tell your friend that convention suggests that class names be written
with the first letter capitalized: SampleProgram rather than sampleProgram.

Not that it solves your problem, of course.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top