Cannot run files in Oracle oxygen - java

So I am in a personal study class in high school to prepare for college. Right now I am just starting the DS Malik Java textbook. I tried to set it up with Oracle Oxygen, but I cannot get it to work. I have only worked in Android studio prior to this and I cannot for the life of me figure this out.
I have tried the steps from this link -> How can I avoid this Ant Build error?
I created a new project and imported it to the SRC folder like it said, I am not sure what it means by compliling, I think it means run and it still wont run. Now it just says it is unable to run.
I just am still lost. I cannot figure out how to create a project that I can run the files in for this textbook. IF any of you want to try it out before you reply since I know I am not being very forthcoming on details, there really aren't much I can say. But the source code is available online if you google it it will be there.
Thank you all for your help.

Related

Cant find Packages in Eclipse

Recently I have been working on coding Minecraft mods. Yesterday i updated to a 64 bit version of Java, and I began to receive an error that said something of this nature: "Java returned error = 13". I looked around, and discovered that my Eclipse was not 64 bit, so I went to Eclipse, and downloaded the latest 64 bit version. I then replaced my normal eclipse folder with the new one, and it launched fine. However, when I open Eclipse, (I open the exact same workspace as I did before all of this happened), I don't see anything in the Package Explorer view. Nothing at all. Typically it says MDK Example or something like that, and within that are all of my packages, etc.
Here is my question: How can I make it to where I see all of my files in the package explorer like they used to? I am using the same Workspace...
Just a warning: I code a lot, and I believe that now I'm quite skilled at it, however I am not good with computers themselves (hence why I find myself in this predicament). If I need to completely start over, I can, and I can copy over my code. It would be a nuisance but if that is all that is left to do I will do so.
Thank you for reading! Please help if you can :)
I remember encountering a similar problem after having switched the location of my workspace.
Try the following: Choose a different location for your workspace and then choose File>Import>General>"Existing Projects into Workspace".

Java files are missing in Master/Detail Flow (Eclipse)

I have a problem with Eclipse. When I want to start a new android project I only get xListFragment.java in my source folder. So, I'm missing the other 3 java files( detailActivity, DetailFragment, and ListActivity). I have reinstalled eclipse 3 times and updated and istalled all programms from scratch but still haven't got those files. If someone has an solution then please help me.
Best.
Until someone has a definite solution to post, here's a workaround. I had the same problem with Eclipse and the master-detail project. I tried multiple times creating the project and had those missing classes each time. To workaround the problem, I created a master-detail project in Android Studio and copied over the missing classes and some bits of XML.

How do you use a Java project in your Android project in Eclipse?

I'm writing an Android application and there's some Java code in it that's somewhat sophisticated and therefore hard to verify the correctness of in the Android environment. I would like to run this code in a desktop environment where I have more tools with which to examine the output of this code while still using it in my Android application.
My attempted solution is to have three different projects in Eclipse. My Android project and two plain (non-Android) Java projects. One Java project has the sophisticated code that I want to use in Android and the other is a test program that verifies the correctness of the former project. The latter project has already been useful in debugging the former.
However, so far, my attempts to use the Java project in my Android project appears to work in the IDE but when I actually run the Android application, the NoClassDefFoundError exception is thrown whenever I try to access any of the classes. Obviously, that code is not being recompiled into the .dex file but why not?
I could go into detail about what I've done so far but I can't help but think that what I'm doing is a pretty standard and simple thing and there's a plain way of doing it, even though I can't find anyone doing quite what I'm trying. Can someone describe to me how this is done?
Luckily, I found the answer to my own question and I thought I'd share it here to help others in the same situation. It turned out to be very simple...
What I was already doing would have normally worked, which should have been a big clue to me since I have actually done this before, successfully. All you have to do is, under your Android project's Properties > Java Build Path > Projects, add the plain Java project to your "Required projects on the build path" and then under Properties > Java Build Path > Order and Export, check the checkbox of that same project in the "Build class path order and exported entries" list and everything should just work.
From within Eclipse, there's nothing else you need to do to get this setup to work. It's only when you're compiling from the command line that you need to build Java Jars and import them as libraries but I'm not doing that (yet).
Finally, this wasn't working for me because I just happened to be compiling my plain Java project under JDK 1.7 compliance, while my Android project was compiled under JDK 1.6. This is verified by the output on the Console pane, reporting "Dx bad class file magic (cafebabe) or version." This error message goes away when both projects are compiled under the same compliance level and, not coincidentally, the Android program runs properly.
Thank you to everyone who tried to help and I hope this answer is helpful to someone out there!
Would it not work if you made your other plain java project into an Android project and use it to monitor the output on the device?

Thinking in java library installation

Hi i've been trying to install the library on Thinking in Java book 4th edition and i hit a very thick brick wall. I've done everything that the guide from the website told me to do and i still can't get the library to work. From what i've read it seems that the problem is from the build.xml files. having no xml knowledge I am clueless about how I have to modify it in order for it to work. In both cmd and eclipse I am getting these error
c:\TIJ4\code\build.xml
Build Failed
c:\TIJ4\code\build.xml:59:J2SE5 required
Can anyone tell me what I should do ?
I am using eclipse if there is a simpler solution by using eclipse rather than ant please help me out. It's been a week now and I still can't make it work.
The important thing to do is to realize that your ant file has a specific java requirement.
Something to try that might fix this very easily : I believe you can remove any references to a specific JDK, and if you have a reasonably up to date JDK, the build will succeed.
The definete fix : Look into the exact (line 59) of your build file, and try to satisfy the java version that line requires. Java is generally backwords compatible -- something designed to run in J2SE5 should run in the latest JDK. Its not terribly difficult to update your JDK (just google for instructions on your OS).
The most common mistake I see is that people who have the java run time installed believe they also have the Java SDK as well.
Does this "install the library" means you want to look at the code and run them in your eclipse? If so I can share my experience with you.
First run the Eclipse.py script; this will add package info to the source code
Create a new Java project in Eclipse, and then just copy all the source code folders to the src source folder in eclipse, these folders will then be recognized as Java packages.
You should be able to run the classes with a main function.
You can also configure which java version to use for this project in Eclipse build path. 1.5 or higher will work.

Java makefile to eclipse project

I have an makefile version of a java project which is organized as follows:
CLASSFILES=Main/Main.class Lex/BooleanLiteral.class< and so on>
JAVAFILES=IR/*.java
CFILES=Runtime/*.c
I am looking to move this to Eclipse so that I would be able to debug it better( I need to implement a feature in this codebase and i need to understand the codeflow better. )
I am a C++ programmer and I have just moved to Java programming, i have tried to follow the instructions in this link
How do I import a pre-existing Java project into Eclipse and get up and running?
but i am getting the following error, the project was not built since its build path is not complete. I am really stuck here, any help would be much appreciated.
Regards,
Subramanian

Categories