Discussion:
[Geany-Users] Java in Geany - Fully Qualified Classname
es noyo
2018-11-07 19:59:53 UTC
Permalink
How do I get Geany to automatically pick up the fully qualified classname from the java project that I'm working on in order to run the project?

I'm trying to import some java applications I had previously written elsewhere (Windows + Eclipse, though I've only imported the java files, not attempting to import projects). I've been looking at https://wiki.geany.org/howtos/configurebuildmenu but can't seem to get the settings right.

So far I've worked out how to get javac up and running. I'm using this entry in the build menu:
Command field: javac "%f" -d /home/me/Documents/Java/Classes -cp /home/me/Documents/Java/Classes
so that it finds source files and leaves classfiles in the structure below:
/home/me/Documents/Java/Source/ProjectA
/home/me/Documents/Java/Source/Utilities/etc/etc
/home/me/Documents/Java/Classes/....
As I said, this looks like it is working ok.

The problem is what command string to use in the execute part of the build menu. I've tried:
Command field: java -classpath /home/me/Documents/Java/Classes "%e"
Working directory field: /home/me/Documents/Java/Classes

However I'm getting the error: "Error: Could not find or load main class".

Clearly I can see that it doesn't have the right form of classname in it. I know the java command is supposed to use the Fully Qualified Classname of the form "java com.example.ProjectA". Obviously I want it to pick this up automatically from the project. How do I do this?

Thanks for any clues
Duncan
--
Professional Virtual Office
https://www.contactoffice.com
Lex Trotman
2018-11-07 20:05:55 UTC
Permalink
Post by es noyo
How do I get Geany to automatically pick up the fully qualified classname from the java project that I'm working on in order to run the project?
I'm trying to import some java applications I had previously written elsewhere (Windows + Eclipse, though I've only imported the java files, not attempting to import projects). I've been looking at https://wiki.geany.org/howtos/configurebuildmenu but can't seem to get the settings right.
Command field: javac "%f" -d /home/me/Documents/Java/Classes -cp /home/me/Documents/Java/Classes
/home/me/Documents/Java/Source/ProjectA
/home/me/Documents/Java/Source/Utilities/etc/etc
/home/me/Documents/Java/Classes/....
As I said, this looks like it is working ok.
Command field: java -classpath /home/me/Documents/Java/Classes "%e"
Working directory field: /home/me/Documents/Java/Classes
However I'm getting the error: "Error: Could not find or load main class".
Clearly I can see that it doesn't have the right form of classname in it. I know the java command is supposed to use the Fully Qualified Classname of the form "java com.example.ProjectA". Obviously I want it to pick this up automatically from the project. How do I do this?
Geany works on filenames, it doesn't know about Java specific stuff
like classnames (or any other language specific stuff either). So you
will either have to do some shell smarts to extract the classname or
hard code it in a project specific run command.

Cheers
Lex
Post by es noyo
Thanks for any clues
Duncan
--
Professional Virtual Office
https://www.contactoffice.com
_______________________________________________
Users mailing list
https://lists.geany.org/cgi-bin/mailman/listinfo/users
es noyo
2018-11-07 21:37:45 UTC
Permalink
Hi
Ah ha, the penny has dropped now, thank you.

For other folks who might be interested this is what I've used:

Command field: java com.example.ProjectA
Working directory: /home/me/Documents/Java/Classes
Base path: /home/me/Documents/Java/Classes

I'm not quite sure of the inner workings though it seems ok with the Working Directory and Base Path being the same.

Regards
Duncan
----------------------------------------
Sent: Wed Nov 07 21:05:55 CET 2018
Subject: Re: [Geany-Users] Java in Geany - Fully Qualified Classname
Post by es noyo
How do I get Geany to automatically pick up the fully qualified classname from the java project that I'm working on in order to run the project?
I'm trying to import some java applications I had previously written elsewhere (Windows + Eclipse, though I've only imported the java files, not attempting to import projects). I've been looking at https://wiki.geany.org/howtos/configurebuildmenu but can't seem to get the settings right.
Command field: javac "%f" -d /home/me/Documents/Java/Classes -cp /home/me/Documents/Java/Classes
/home/me/Documents/Java/Source/ProjectA
/home/me/Documents/Java/Source/Utilities/etc/etc
/home/me/Documents/Java/Classes/....
As I said, this looks like it is working ok.
Command field: java -classpath /home/me/Documents/Java/Classes "%e"
Working directory field: /home/me/Documents/Java/Classes
However I'm getting the error: "Error: Could not find or load main class".
Clearly I can see that it doesn't have the right form of classname in it. I know the java command is supposed to use the Fully Qualified Classname of the form "java com.example.ProjectA". Obviously I want it to pick this up automatically from the project. How do I do this?
Geany works on filenames, it doesn't know about Java specific stuff
like classnames (or any other language specific stuff either). So you
will either have to do some shell smarts to extract the classname or
hard code it in a project specific run command.
Cheers
Lex
Post by es noyo
Thanks for any clues
Duncan
--
Professional Virtual Office
https://www.contactoffice.com
_______________________________________________
Users mailing list
https://lists.geany.org/cgi-bin/mailman/listinfo/users
--
Professional Virtual Office
https://www.contactoffice.com
Loading...