• Post Reply Bookmark Topic Watch Topic
  • New Topic

Newbie needs help trying to use Geany portable  RSS feed

 
dab yabao
Greenhorn
Posts: 2
Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm starting out in Java programming but have no prior knowledge in any programming language. I'm trying to use Geany portable. The problem is I can't run even the Hello World program.

I was able to save the source file as MyFirstJavaProgram.java but I cannot compile nor run it.
Here's what I see on the compiler message window when I click on "Compile":

javac "MyFirstJavaProgram.java" (in directory: C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Portalet\GeanyPortable\App\Geany)

And then the status bar reads "Process failed (The system cannot find the file specified)"

I tried to run the program and this is what I get:

"Exception in thread "main" java.lang.NoClassDefFoundError: MyFirstJavaProgram
Caused by: java.lang.ClassNotFoundException: MyFirstJavaProgram
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class: MyFirstJavaProgram. Program will exit."

I've done no initial setting up of preferences, so I just ran Geany after installation.

I hope someone would be kind enough to help and explain these to me.
Thank you in advance!

-dub16
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16057
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where did you save your source file?

According to the error message, the Java compiler cannot find your source file. And if the compiler can't find it, it also cannot compile it, and when you then try to run the program it isn't going to work because you need to successfully compile it first. You'll have to configure Geany so that it directs the compiler to look at the correct location for your source file.

Maybe it's better to try compiling and running from the command prompt window first. Oracle's Hello World tutorial explains how to do that step by step.
 
dab yabao
Greenhorn
Posts: 2
Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

The source file is on this location:

C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Portalet\GeanyPortable\App\Geany

So Geany saves the source file in a folder within its installation folder. I've been trying to figure out why the compiler could not locate the file when it's being displayed on the 'Files' tab on the left of the editor.

One more question. It says on Geany's web page that this: 'Build system to compile and execute your code' is one of Geany's basic features. Does this mean that with Geany I don't need to install a separate compiler?

I used Geany because I'm working on a computer that has administrator restrictions with regards to installing applications/soft wares. That is why if you noticed, I had Geany installed in my local folder. Hehe.

Thank you for your reply. I will look into Geany's configuration and see if I can figure out how to direct the compiler to the source file's location.

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!