Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » How to compile & run a multi-class & a complete program?(Use of Eclipse to build a multi-class complete program to compile & run)
How to compile & run a multi-class & a complete program? [message #1768802] Mon, 24 July 2017 05:25 Go to next message
RajibKumar Bandopadhyay is currently offline RajibKumar BandopadhyayFriend
Messages: 58
Registered: July 2014
Member
Caveat: If there is already a thread with a similar target I am willing for this thread to be deleted.

I downloaded this zipped file, extracted it and ran from within the extracted folder from the terminal with
~$java Notepad
This is a brilliant program, completely built and functional!

But how would I use the class files to build and run the package from within Eclipse? Which files do I have to remove in order for the package to be studied, recompiled and run from both within Eclipse and by executing the compiled program as above?

[Updated on: Mon, 24 July 2017 06:36]

Report message to a moderator

Re: How to compile & run a multi-class & a complete program? [message #1768821 is a reply to message #1768802] Mon, 24 July 2017 07:27 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 29389
Registered: July 2009
Senior Member
I think you want to work with this source: https://www.javatpoint.com/notepad Copy and paste it into a Java project's src folder.
Re: How to compile & run a multi-class & a complete program? [message #1768829 is a reply to message #1768821] Mon, 24 July 2017 08:20 Go to previous messageGo to next message
RajibKumar Bandopadhyay is currently offline RajibKumar BandopadhyayFriend
Messages: 58
Registered: July 2014
Member
Exception in thread "main" java.lang.Error: Unresolved compilation problem: 

	at Notepad.main(Notepad.java:603)


Run as Configuration:

index.php/fa/30090/0/

[Updated on: Mon, 24 July 2017 08:33]

Report message to a moderator

Re: How to compile & run a multi-class & a complete program? [message #1768842 is a reply to message #1768829] Mon, 24 July 2017 10:04 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 29389
Registered: July 2009
Senior Member
It sounds like your source code contains errors. My mistake, the zip file does contain *.java files. Use File -> Import -> General -> Archive File to import the 5 *.java files into your Java project's src folder.
Re: How to compile & run a multi-class & a complete program? [message #1768869 is a reply to message #1768842] Mon, 24 July 2017 13:47 Go to previous messageGo to next message
RajibKumar Bandopadhyay is currently offline RajibKumar BandopadhyayFriend
Messages: 58
Registered: July 2014
Member
Ed Merks wrote on Mon, 24 July 2017 06:04
... the zip file does contain *.java files. Use File -> Import -> General -> Archive File to import the 5 *.java files into your Java project's src folder

Java Project named "Tasty".
Only 5 java files imported from the zip archive with filter *.java
Then what, please inform!
The result is below:
index.php/fa/30094/0/
Re: How to compile & run a multi-class & a complete program? [message #1768892 is a reply to message #1768869] Mon, 24 July 2017 16:06 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 29389
Registered: July 2009
Senior Member
Notice you have a Notepad folder. But these .java files don't declare a Notepad package; so they must be ad the root. Move all the *.java files directly into the src folder and delete the Nodepad folder.
Re: How to compile & run a multi-class & a complete program? [message #1768896 is a reply to message #1768892] Mon, 24 July 2017 17:19 Go to previous messageGo to next message
RajibKumar Bandopadhyay is currently offline RajibKumar BandopadhyayFriend
Messages: 58
Registered: July 2014
Member
Thanks, Sir! The application now runs!

Sir, you said:Quote:
... But these .java files don't declare a Notepad package ...

Sir, what do you mean by package? Do you mean the class file creation? In Notepad.java there is a Notepad class declaration here:
public class Notepad  implements ActionListener, MenuConstants
{

Done, and then ran the Notepad.java via "Run Configurations..."

There were a few more files within the zipped files, when downloaded and uncompressed. Also, the Notepad.jar file doesn't exist in our Eclipse-created set. The Eclipse-created ones are:
Quote:
FileFilterDemo$1.class FontChooser$1.class LookAndFeelMenuListener.class
FileFilterDemo.class FontChooser$2.class MenuConstants.class
FileOperation.class FontChooser$3.class MyFileFilter.class
FindDialog$1.class FontChooser$4.class Notepad$1.class
FindDialog$2.class FontChooser$5.class Notepad$2.class
FindDialog$3.class FontChooser.class Notepad$3.class
FindDialog.class FontDemo$1.class Notepad$4.class
FindReplaceDemo$1.class FontDemo.class Notepad$5.class
FindReplaceDemo$2.class LookAndFeelDemo.class Notepad$6.class
FindReplaceDemo.class LookAndFeelMenu.class Notepad.class
A total of 30 items
and the five under the root:
Quote:
FindDialog.java
FontChooser.java
LookAndFeelMenu.java
MyFileFilter.java
Notepad.java

which make them 35, while, under the zipped file, there were 38:
Quote:
FileFilterDemo$1.class FontChooser$3.class MyFileFilter.class
FileFilterDemo.class FontChooser$4.class MyFileFilter.java
FileOperation.class FontChooser$5.class Notepad$1.class
FindDialog$1.class FontChooser.class Notepad$2.class
FindDialog$2.class FontChooser.java Notepad$3.class
FindDialog$3.class FontDemo$1.class Notepad$4.class
FindDialog.class FontDemo.class Notepad$5.class
FindDialog.java LookAndFeelDemo.class Notepad$6.class
FindReplaceDemo$1.class LookAndFeelMenu.class Notepad.class
FindReplaceDemo$2.class LookAndFeelMenu.java Notepad.jar
FindReplaceDemo.class LookAndFeelMenuListener.class Notepad.java
FontChooser$1.class MenuConstants.class Notepad.mf
FontChooser$2.class MyCalculatro.mf


Next, I also tried the folderexplorer.zip using your instructed method, finding only one java file, ExplorerTest.java . I tested the program, but it is not a very intuitive program.

Subsequently, I will try with other zipped program files gradually.

Thank you for your direction!

[Updated on: Tue, 25 July 2017 06:17]

Report message to a moderator

Re: How to compile & run a multi-class & a complete program? [message #1768907 is a reply to message #1768896] Mon, 24 July 2017 20:14 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 29389
Registered: July 2009
Senior Member
https://stackoverflow.com/questions/12652899/difference-between-package-and-directory-in-java
Re: How to compile & run a multi-class & a complete program? [message #1768934 is a reply to message #1768907] Tue, 25 July 2017 06:16 Go to previous messageGo to next message
RajibKumar Bandopadhyay is currently offline RajibKumar BandopadhyayFriend
Messages: 58
Registered: July 2014
Member
Many thanks! The link's contents appear simple, but are real deep.
Let's use the context of the application Notepad.java I have used for my queries.

It appears that I would be quite rational and logical if I asked:
What would then have been a Notepad package? Would it have been a (an imaginary) Notepad method? Like for example, Vehicle.4wheeler.car.ICE.Gasolene ? [ICE for internal combustion Engine]

[Updated on: Tue, 25 July 2017 07:35]

Report message to a moderator

Re: How to compile & run a multi-class & a complete program? [message #1768951 is a reply to message #1768934] Tue, 25 July 2017 07:55 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 29389
Registered: July 2009
Senior Member
If you were to ask a question, it should be about how to use Eclipse.
Re: How to compile & run a multi-class & a complete program? [message #1768962 is a reply to message #1768951] Tue, 25 July 2017 08:46 Go to previous messageGo to next message
RajibKumar Bandopadhyay is currently offline RajibKumar BandopadhyayFriend
Messages: 58
Registered: July 2014
Member
Yes, it appears that I had had an amnesia about my ambit at the time of my asking the question! I apologise!
Re: How to compile & run a multi-class & a complete program? [message #1772528 is a reply to message #1768962] Tue, 12 September 2017 01:58 Go to previous messageGo to next message
RajibKumar Bandopadhyay is currently offline RajibKumar BandopadhyayFriend
Messages: 58
Registered: July 2014
Member
To the wandering posters, in case they arrive at this post:
Please read this post, Re: Codes run as JNLP with IcedTea but don't from within Eclipse! carefully. It clarifies a very important issue.
Re: How to compile & run a multi-class & a complete program? [message #1782817 is a reply to message #1768821] Thu, 01 March 2018 20:35 Go to previous message
Sharad Jaiswal is currently offline Sharad JaiswalFriend
Messages: 1
Registered: March 2018
Junior Member
Its worked for me thanks
Previous Topic:Bugs -Angular plugin eclipse is throwing error while creating angular project
Next Topic:Eclipse does not start when I run the exe?
Goto Forum:
  


Current Time: Thu Jun 21 10:49:45 GMT 2018

Powered by FUDForum. Page generated in 0.03324 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top