I have downloaded and installed the latest version of Java JDK (both version X86 and X64) [as Stanford tutorial said].
As of writing the latest version is 8u66
But still the program doesn't show up anything. I don't like eclipse and I'm pretty sure that somehow this program works on IntelliJ too. I've done the steps below:
1. File -> New -> Project from Existing Source -> Assignment1
2. paste the following code into the CollectNewspaperKarel.java
public static void main(String[] args) {
stanford.karel.Karel.main(new String[] { "code="
+ StoneMasonKarel.class.getCanonicalName() });
}
public void run() {
}
and clicked on run. the programs runs perfectly but nothing doesn't show up.
IntelliJ IDEA IMAGE,
I have searched a lot, and a lot of people said we should have JRE/JDK1.6 but on Stanford website is "Before installing Eclipse, you will first need to have a copy of the latest version of the Java JRE (Java Runtime Environment) installed on your computer. Note that Java version 1.8 is the latest version of Java."
So I assume this program should work on latest version of java too not only on 1.6
OS: Windows 10 X64 | JAVA: jdk-8u66 (both X64 and X86) | IntelliJ IDEA: v.15.0.2
https://web.stanford.edu/class/cs106a/software/index.html
I am going through courses on SEE. I also had the blank Java window when I ran a java file from the Assignments download.
I was able to get them to run in JDK 1.8 using the standard Eclipse.
Here's what I did...
There is a Stanford Eclipse plug-in. I found instructions for that at https://web.stanford.edu/class/archive/cs/cs106a/cs106a.1178/eclipse/. Under the installation instructions for Mac or Windows, whichever you use, there is a link to the Stanford plug-in.
Then go to https://web.stanford.edu/class/archive/cs/cs106a/cs106a.1178//resources/ and download, unzip and import into Eclipse the BlankKarelProject.zip file.
Now, I don't know a lot of stuff. But when I imported that Blank one and ran that java file, I got a blank world to load. Then in that java application window, I clicked the Load World button. A file window opened up and I navigated to the file on my local disc the world named "CollectNewspaperKarel" and then I see what the world is supposed to look like for that assignment.
I notice for the imported Assignment file there is no src or lib dirs. My best guess is I can work on/edit the assignment in the respective assignment's java file then copy paste it into the BlankKarel.java file, run, see it happen in the world I selected.
Related
I am relatively new to stack overflow, VSCode, and programming. I am using a Mac. I downloaded VSCode for use with Python around two months ago. I can not run my code in VSCode but I enjoyed working in VSCode so I would write in it and run my code outside of it. Now I have the same issue with Java. I can not "solve," this in the same way because I do not know how I can run my Java code outside of an IDE.
I first read the instructions for setting up VSCode for Java on VSCodes website. I followed the instructions but when I tried to run a, "Hello world," program it said I did not have a debugger. I re-installed Redhat's Java support, closed and re-opened VSCode, and tried to run it again. This time it said java.jdt.Is.home is pointing to a missing or inaccessible folder. I looked this up found one description of this issue from 2018. I had a hard time understanding what it was asking me to do but at my best interpretation I wrote "which java," in Terminal and copy pasted what it returned (usr/bin/java) into settings.json after "java.home: ". This gave me an error stating that it is outdated and I should change it to, "java.jdt.Is.home: " so I did. I also tried adding "local/" between "usr/" and "bin" as it appeared in my path to my Python3 interpreter. All of these gave me the same error when I tried to run a hello world program.What can I do to solve my issue with Java in VSCode?
which java can not get the right java home.
You need to take /usr/libexec/java_home or /usr/libexec/java_home -V.
Java home on MacOs looks like: /Library/Java/JavaVirtualMachines/jdk-16.jdk/Contents/Home
But You need not set the "java.jdt.ls.java.home" at all. Because the JRE has been embedded in the Language Support for Java(TM) by Red Hat extension.
Only the universal version without embedded JRE can specify the java.jdt.ls.java.home manually. Otherwise, it will search JDK_HOME JAVA_HOME current system path.
You can refer to the official dosc.
So, have you installed the related extensions? You can install Extension Pack for Java, which contains the extensions you need.
I am a little confused about why you can not run the python or java codes, it's very rare. After you installed the related extensions(Python Extension Pack) , just right-click in the editor, you can select the Run Java Debug Java Run Python File in Terminal and so on. Or you can click the button on the top-right.
I'm still new to IntelliJ and still learning how to use it. Basically I have created a program already before and I just want to use my existing .java files in IntelliJ. I tried import/open option on the intro screen of IntelliJ but when I opened the .java files there weren't any menus, no functions, and you can't run the program at all, it just seemed to open a tabbed text editor of my .java files. So I tried creating a new project, and then opening the .java files afterwards, but no dice too, the run button is blacked out and I can't run my program. I used the command prompt before and used java (filename.java) to run my program and now just migrating to use an IDE. Can somebody help? I seem to have stuck at the beginning of my IDE journey.
You cannot simply open a file using Java. IntelliJ IDEA needs several configuration like Java SDK and other configuration files in order to run it. You have to create a simple Java project and copy your already created Java file into that project's src directory. Then you will be fine.
I just opened the first folder with '...web' as part of its name :) Not sure how scientific that was.
I am using Jet Brains Itellij Idea version with this info:
IntelliJ IDEA 2021.2.3 (Community Edition)
Build #IC-212.5457.46, built on October 12, 2021
Runtime version: 11.0.12+7-b1504.40 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 10 10.0
GC: G1 Young Generation, G1 Old Generation
Memory: 1972M
Cores: 4
Kotlin: 212-1.5.10-release-IJ5457.46
I drilled to a folder called detourweb. The app found what it needed.
Again, not sure how scientific or repeatable this method is. Assuming all developers will have some 'web' file in their project, try rolling the dice and drill to the first such file.
I don't expect a lot of up votes here, LOL. Here's an answer from a .Net Visual Studio dude.
I recently moved from windows 10 to Ubuntu 16.04, I'm a java developer, when I was on windows I installed Vs Code with the java Extension pack. On windows I never Had problem to make my daily work, but on ubuntu, every java file is marked as error, with the message "The import cannot be resolved", searching a litle bit, i found that you can execute the command java:clean the java language server workspace, but this does not fix the problem. I also remove the tmp files from the workspace located on:
~/.config/Code/User/workspaceStorage
the current Version of Vs code is 1.41.1
the current version of Java Extension Pack is 0.8.1
Any ideas?.
Regards!.
Edit:
all my java files are marked as error
inside of every java file
this is the result of the maven-install
well, after a while of searching, I found that the "maven for java" plugin was trying to download the maven plugin maven-metadata.xml, which wasn't available on my repo. this caused a conflict with the initial build that maven for java was doing. to avoid to update every time I opened vs code, I removed the option "update snapshots"
And the initial build was done.
I am new learner of public sources of Stanford cs106a. I got sucked when run my assignment1. You can download it from here:
https://see.stanford.edu/materials/icspmcs106a/Assignment1.zip
I suppose to see the image on the following file after press run on Stanford menu and choose CollectNewspaperKarel code.
https://see.stanford.edu/materials/icspmcs106a/07-assignment-1-karel.pdf
But there is no any Karel or his world. I didn’t get any error. I am running eclipse 2018-9 and my JDK version is 11.0.1 on macOS Sierra 10.12.3. I added the Stanford plugin as well. I do the following instruction for installing eclipse and the plugin:
https://web.stanford.edu/dept/cs_edu/eclipse/
How should I solve my problem to see Karel at result window after run assignment?
P.S. My English isn't good actually!
I also had a same problem with those files.
The Assignment1.zip file seems working with the Java 6 runtime only.
You can still run it by downloading the legacy Java 6 runtime here and install it.
https://support.apple.com/kb/DL1572?locale=en_US
Then you need to configure to use the runtime.
Preference -> Java -> Installed JREs
Click Search
Select /Library/Java/JavaVirtualMachines/1.6.0.jdk
Check it
Preference -> Java -> Compiler
Select 1.6
However, I actually found newer assignments files which work with the updated Java runtime.
https://web.stanford.edu/class/archive/cs/cs106a/cs106a.1178/
If you follow the Eclipse link, there are instructions to setup it.
You can also find each assignment page links.
For example, find Assignment 1: Karel the Robot on the above page and follow the assignment page link below.
Find Click here to redownload the starter code if you have already completed the Honor Code form.
You can download CS106A-Assignment1.zip which works with the updated Java runtime.
I am little .NET oriented, and new to Java stuff. Using Eclipse IDE, whenever i extend my class by Applet as:
class xyz extends Applet{ . . . };
this gives error. and no suitable oauto-fix. i tried importing manually as
import java.applet.Applet;
But this gives error too. I tried to look up for the problem over internet, but only find the way to create applet, not the solution. Kindly guide me. Do I have to import some files in my Eclipse IDE?
(i forgot to mention, I am using it in my Android Application Project)
As Mr. Thompson said, applets don't work in android. The tutorial you posted may does some Android stuff later - however not in that specific tutorial you linked ("But wait until we start developing on Android" [...at some day in the future and in some other tutorial]). And as you may see the first screenshot he selects
"Package Explorer >> New >> Java Project" and not the below Android Application Project.
So did you really (exactly) followed that tutorial step by step? If so, everything should be working. If not you made a mistake or your eclipse is misconfigured.
whenever you import any class using import statement, it will import from JRE which is linked to Eclipse IDE.
If your IDE not linked to JRE then you will get this type of errors.
to remove these errors, first set some settings in Eclipse.
go to window >> Preferences - you can see one screen now.
here you can go to java >> Installed JREs
if there are no JRE then you can add JRE from your local C: drive.
generally you can find your JRE on the location below(if you have windows machine):
C:\Program Files\Java\jre7 (if you have 32 bit OS)
OR
C:\Program Files (x86)\Java\jre7 (if you have 64 bit OS)
you can also set the compiler compliance level same as your JRE version or below to JRE version but not upper version .(for this you can go to java >> compiler)
In your project in Eclipse, check if you have JRE System Library, like this
(source: ibm.com)
If not, Go to Window - Preferences - Java - Installed JREs page to specify the path of your JRE or JDK.