Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Build "Thinking in Java" Example Files to Run in Eclipse IDE?

Tags:

java

I wanted to learn Java, as recommended by most of the people I downloaded "Thinking in Java" eBook and Source Code Example Lesson files from mindviewinc.com it's download location is this http://www.mindviewinc.com/TIJ4/CodeInstructions.html

These files don't work with Eclipse IDE for some reasons. So we have to build the files using the Build.xml file included in it's source code (Honestly, I do not have any idea what does "build" means here)

I tried building myself but of no use.. It did started building but after reaching some folder it stopped and gave error to install jboss-osgi-installer-1.0.0.jar .. After downloading it, I had no idea what to do with it, so I double clicked it and it asked me the location to install and I installed it in the default location, which was C:\Users\Username/jboss-osgi-1.0.0 and when I tried C:\Program Files\Java** the installation gave error that "this directory cannot be written, please choose another directory!" but anyway I installed it in the default location and it installed..

and again when I tried to build it, it gave me the same error and asked to Install Jboss....... I'm stuck.. This is happening again and again, wasted many days and didn't even crossed 100 pages of it's pdf because of this reason. It's a good eBook though.

I'm stuck in this from months... Please some one build it and make it like a project which could be easily and send me the project file, it would be really appreciated as I can not the solution to this anywhere on search engines..

like image 911
Nayeem Junaid Avatar asked Dec 28 '22 14:12

Nayeem Junaid


1 Answers

"This code is designed to work outside of IDEs. Because packages are not introduced until later chapters, and some of the fancier IDEs like Eclipse require all code to be in packages, if you want to use the code inside those IDEs you will have to make some adjustments" - yep, bruce eckel would say that, cause that's the kind of guy he is. He also said there's ONLY checked exceptions in java, and asked for unchecked exeptions to be added as a bonus.

Now, if your sample code has no package, aka it's in the default package, aka when you look in the .java file, right at the top there's no line saying "package what.ever.bla" then all you have to do is:

-in Eclipse create a new Java se project - open a windows explorer, go to your .java files, select them and copy them - then in eclipse, right click the src folder in your project and chose "paste"

The files should be added to a "default" package in your eclipse project, without any error

like image 194
Shivan Dragon Avatar answered Dec 30 '22 04:12

Shivan Dragon