Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
hooah
Feb 6, 2006
WTF?
I'm trying to follow Stanford's Intro to Programming course to learn Java. However, there seems to be a problem with their distribution of Eclipse for Windows (here), or perhaps it just doesn't work well with Windows 8. When I try to run that, I get this hideous mess of errors that I don't understand. Could someone help me get this working?

I also tried using standard Eclipse, but couldn't get a Karel the Robot project working with it.

Adbot
ADBOT LOVES YOU

hooah
Feb 6, 2006
WTF?

Zaphod42 posted:

I don't have windows 8 so I don't know of its horrors, but you should be fine just using the normal Eclipse for Windows devs from the Eclipse page.

What was your problem with getting "Karel the Robot" to work with it? You're probably just not familiar with Eclipse, which I guess is why Stanford had a special build of Eclipse packaged ready to go. You'll just have to import the right project and make sure the build path is properly configured.

Using the standard version of Eclipse, I followed the directions here to set up Karel with Eclipse. However, likely due to my brand-newness at Java, I couldn't figure out how to translate the importing and class setup for the program written in the second lecture into something that would work with the directions I linked above.

hooah
Feb 6, 2006
WTF?

Zaphod42 posted:

That seems fine. If you've got the libraries imported, the 'second lecture program' you refer to should work. Namespaces are set up such that it shouldn't be machine specific.

So you're saying you've got the program that Stanford wants you to look at open in Eclipse, and Eclipse has the Karel external libraries imported.

So, whats the issue? You're getting a compilation error when you try to build the program?
Can you put the program on pastebin, or copy the output of the compiler error here for us? Need more information.

You may just have to make sure the library is imported for specifically that project. Alternatively Java's just complaining because your package name doesn't match the source folder or something, odds are you can just mouse over the red underline and Eclipse will suggest a fix for you. (Package name X should be Y, for example) Click the underlined text and it'll apply the fix automatically.

I think my problem lies in importing. Currently, my project hierarchy is
code:
MyProject
 |_src
 |  |_kareltherobot
 |      |_OurKarelProgram.java
 |_JRE System Library
 |_KarelJRobot.jar
My java file is as follows:
code:
package kareltherobot;

import KarelJRobot.jar.* // This probably isn't right
public class OurKarelProgram extends Karel{
	public void run() {
		move();
		turnLeft();
	}
}
I forgot to add that Eclipse has underlined KarelJRobot, the class name Karel, and of course the methods.

hooah fucked around with this message at 20:13 on Dec 18, 2013

hooah
Feb 6, 2006
WTF?

Jabor posted:

You don't need to import the .jar file - instead, you import the specific classes you want to use, and Eclipse uses your classpath setup to figure out where they are.

With the code you have right now, you should be able to delete that import line, and then if you hover your mouse over the "extends Karel" statement then Eclipse should offer to fix it for you by importing the Karel class.

The fixes I'm offered are "Create class 'Karel'", "Change to 'Kernel' (java.awt.image)", and "Fix project setup...", none of which does what you say.

hooah
Feb 6, 2006
WTF?

rhag posted:

you will want to choose fix project setup, and add that jar onto the project's classpath. then you will have it available.

Could you go into a little more detail? Keep in mind I've never worked with java or Eclipse before. Here's the dialog I see when I choose fix project:

hooah
Feb 6, 2006
WTF?
Alright, I got the import working (turns out I had to import "kareltherobot", not add any external stuff), but I can't figure out the right name to extend. I've tried Karel, KarelJRobot, and kareltherobot. Here's my project directory:

hooah
Feb 6, 2006
WTF?

Woodsy Owl posted:

You've got to import the package by it's package name and follow it by a .* or a specific class. For example:
Java code:
//This is going to import all the classes for use in your project.
import kareltherobot.*;
or
Java code:
//This is going to import only these classes for use in your project.
//If you've got to use another class from the package then you're going
//to have to explicitly import it like below.
import kareltherobot.Robot;
import kareltherobot.World;
import kareltherobot.WhateverOtherClassYouNeed;

Yeah, import kareltherobot.*; is what I did.

hooah
Feb 6, 2006
WTF?

Woodsy Owl posted:

What's the error that you're receiving?

I have a line that says public class OurKarelProgram extends kareltherobot{. The problem is that I can't figure out what to put after extends that will satisfy Eclipse. Anything I put there gets underlined, and the mouse-over pop-up says "[whatever] cannot be resolved to a type". I've tried Karel, KarelJRobot, and kareltherobot.

hooah
Feb 6, 2006
WTF?

Woodsy Owl posted:

Oh okay. The keyword 'extends' makes your class an extension of the particular class. So, the 'extends' keyword needs to be followed by a class, not a package. What it means is that your class becomes an extension of the class; your class has the same methods and constructors as the extended class, and you can add your own methods to your class to 'extend' the method.

Hope this helps!

edit: Depending on what the task/assignment is, you might not even need to use the 'extends' keyword.

That helps conceptually, but not really specifically, since evidently the Karel distribution I grabbed isn't quite the same as the one used in the Stanford lectures, so I don't know which class I should be extending. Hmm.

As an aside, do you need the this. in a method, or can you leave the data member naked as in C++?

hooah
Feb 6, 2006
WTF?

Zaphod42 posted:

Here's a page I found on Karel for java

http://programmingjava.net/2-basic-karel-program/

http://programmingjava.net/3-improve-karel-using-methods/

Looks like that's the same library you're using? Yeah, if the Stanford library is named differently than yours then the extends won't work. Unfortunately that means the rest of the API might be different too, so you may want to go back and try to find a better stanford karel library and get that working. Although... this page here references Stanford. Hmm. Maybe they are the same.

You generally don't need to use "this." in a method, class field variables have full class scope. However, if you have a variable with a name like myVar, and then in a method you declare "int myVar = 10;" you're going to now have no way to refer to the class level variable myVar, since they're the same name. This is called shadowing, and the way you can get around it is by saying "this.myVar". The other case where you need this. is if you're passing yourself as a reference ( myMethod(this); ) or some other special cases. It isn't usually needed, no.

Looks like this should work

Java code:
import stanford.karel.*;
public class MyKarel extends Karel {
    public void run() {
        move();
        putBeeper();
        move();
    }
}

I'm not sure if it's the same library. The one I got was from Pace University; the link from that Java tutorial is dead. The first thing I tried doing while watching the lecture video was saying import standford.karel.*;, and Eclipse couldn't resolve the stanford import. I used the contact link on the Stanford site to ask if there's somewhere to download the Karel project or if they could make heads or tails of the error their Eclipse distro was giving me, but based on their automated response, I'm not hopeful.

hooah
Feb 6, 2006
WTF?

Zaphod42 posted:

I'm confused. You said you were doing Stanford's intro to programming course. Stanford sent you to Pace?

You can't use somebody else's library without some kinda documentation. If the links are dead then don't use that. What are you doing this for anyways? Trying to learn java? There's infinity tutorials out there, pick a new one that's better documented and better maintained. Trying to follow along with a different library probably won't work well, especially if you're new. You'll just keep getting bogged down and lost.

I'm doing Stanford's free online course, yes. They didn't provide any sort of Karel anything, so I went looking for something to grab, and found the Pace one.

Since it looks like the Stanford course isn't going to work (at least not the first however many lectures until he moves on past Karel), what tutorials do you recommend? I'm looking to learn Java between semesters so I can go into my second semester with a little more of a varied background than just C++.

hooah
Feb 6, 2006
WTF?

Woodsy Owl posted:

If you've got a bit of a background in programming already (it sounds like you've done some C++) then I would suggest you work through the beginning of the official Oracle Java Tutorials. I would suggest you start at Lesson: Language Basics so you can see how Java syntax differs from C++.

Thanks. I also grabbed the videos mentioned in the OP.

hooah
Feb 6, 2006
WTF?

greenchair posted:

So Ive made a program in eclipse that I kind of like, and I'd like to be able to run it without opening the project in eclipse and then compiling and running it from there. How do I make it into an actual program that I just double click on and then it opens and runs?

I believe you can export it as a jar, which should be runnable on its own. However, the only Java stuff I've done is the tutorial videos hosted on Sourceforge that are in the OP, so take that as you will.

hooah
Feb 6, 2006
WTF?
I'd like to spend some time this summer learning Java. I've had three semesters working with C++ so far, but no other languages. I did the short series of tutorial videos that could be grabbed from Sourceforge, but I'd like a full book to really dig into the language. Any recommendations?

hooah
Feb 6, 2006
WTF?
I'm going through the Java Trails, and for the Exercises here, I'm having a little trouble. Here's my PlayingCard class:
Java code:
package tutorial;

public class PlayingCard {
	private int rank;
	private String suit;
	public PlayingCard(){
		rank = 0;
		suit = null;
	}
	public PlayingCard(int r, String s){
		rank = r;
		suit = s;
	}
	public int getRank(){
		return rank;
	}
	public String getSuit(){
		return suit;
	}
	
}
The class for the deck of cards:
Java code:
package tutorial;

public class DeckOfCards {
	private int numberOfCards = 52;
	private PlayingCard[] myCards;
	public DeckOfCards(int num){
		numberOfCards = num;
		if(num == 52){
			for(int i = 0; i < 13; ++i){
				myCards[i] = new PlayingCard(i, "Hearts");
			}
			for(int i = 0; i < 13; ++i){
				myCards[i + 13] = new PlayingCard(i, "Diamonds");
			}
			for(int i = 0; i < 13; ++i){
				myCards[i + 26] = new PlayingCard(i, "Clubs");
			}
			for(int i = 0; i < 13; ++i){
				myCards[i + 39] = new PlayingCard(i, "Spades");
			}
		}
		else{
			for(int i = 0; i < num; ++i){
				myCards[i] = new PlayingCard();
			}
		}
	}
	public int howManyCards(){
		return numberOfCards;
	}
	public void printDeck(){
		for(PlayingCard card : myCards){
			System.out.println(card.getRank() + " " + card.getSuit());
		}
	}
}
And the test program:

Java code:
package tutorial;

public class CardTest {
	public static void main(String[] args){
		DeckOfCards deckOne = new DeckOfCards(52);
		DeckOfCards deckTwo = new DeckOfCards(10);
		deckOne.printDeck();
		deckTwo.printDeck();
	}
}
When I try to run the test, I get a null pointer exception on line 10 of the DeckOfCards class. I tried debugging it (I know next to nothing about the Eclipse debugger), and I was told that it couldn't find the source for "Thread.dispatchUncaughtException(Throwable)".

What's wrong with my solution? It appears that the error happens when it tries to add the first card, but the solution seems to do something similar:
Java code:
public class Deck {

    public static int numSuits = 4;
    public static int numRanks = 13;
    public static int numCards = numSuits * numRanks;

    private Card[][] cards;

    public Deck() {
        cards = new Card[numSuits][numRanks];
        for (int suit = Card.DIAMONDS; suit <= Card.SPADES; suit++) {
            for (int rank = Card.ACE; rank <= Card.KING; rank++) {
                cards[suit-1][rank-1] = new Card(rank, suit);
            }
        }
    }

    public Card getCard(int suit, int rank) {
        return cards[suit-1][rank-1];
    }
}

hooah
Feb 6, 2006
WTF?
Ah, I see. Thanks, guys. I made a mental note when I read about initializing stuff that it's different than C++, but I didn't really take that to heart.

hooah
Feb 6, 2006
WTF?

Zaphod42 posted:

You still have to call new in C++ or malloc in C so its not really different... the syntax for declaring the array is just slightly different, I guess I see what you mean.

What? You generally don't, unless you want to instantiate something on the heap. Creation of, say, a string on the stack is just string myString = "whatever";. Unless you were implicitly talking about using the heap. Speaking of, does Java use the heap for all non-primitive types?

hooah
Feb 6, 2006
WTF?

Zaphod42 posted:

We were explicitly talking about arrays.

Yeah, I guess we were. Thanks for the expansion.

hooah
Feb 6, 2006
WTF?

baka kaba posted:

This is probably the most 'no poo poo' thing ever but I was learning some Eclipse keyboard shortcuts the other day (we all have our hobbies) and I found out about Alt+\ :swoon:

I mean it's no ctrl+space but it's pretty cool

Did you mean Alt+/? I searched the first few web pages that came up in a search for "Eclipse keyboard shortcuts", and none of them had Alt+\.

hooah
Feb 6, 2006
WTF?
I'm trying to go through the Udacity "Developing Android Apps" course. I'm primarily a C++ guy, but I did take a short MOOC on Java late in the summer. However, I'm stuck on a particular step. There's a class which extends Fragment and has some network code in it. The step is to move it to another file, then create a nested class that extends AsyncTask. In there, I have to create a method that overrides doInBackground. So, here's what I've got for the nested class:
Java code:
public class FetchWeatherTask extends AsyncTask {

        public FetchWeatherTask(){
        }

        @Override
        protected void doInBackground(String something) {
            // These two need to be declared outside the try/catch
            // so that they can be closed in the finally block.
            HttpURLConnection urlConnection = null;
            BufferedReader reader = null;
            // Will contain the raw JSON response as a string.
            String forecastJsonStr = null;
            try {
                // Construct the URL for the OpenWeatherMap query
                // Possible parameters are avaiable at OWM's forecast API page, at
                // [url]http://openweathermap.org/API#forecast[/url]
                URL url = new URL("http://api.openweathermap.org/data/2.5/forecast/daily?q=48911&mode=json&units=metric&cnt=7");
                // Create the request to OpenWeatherMap, and open the connection
                urlConnection = (HttpURLConnection) url.openConnection();
                urlConnection.setRequestMethod("GET");
                urlConnection.connect();
                // Read the input stream into a String
                InputStream inputStream = urlConnection.getInputStream();
                StringBuffer buffer = new StringBuffer();
                if (inputStream == null) {
                    // Nothing to do.
                    forecastJsonStr = null;
                }
                reader = new BufferedReader(new InputStreamReader(inputStream));
                String line;
                while ((line = reader.readLine()) != null) {
                    // Since it's JSON, adding a newline isn't necessary (it won't affect parsing)
                    // But it does make debugging a *lot* easier if you print out the completed
                    // buffer for debugging.
                    buffer.append(line + "\n");
                }

                if (buffer.length() == 0) {
                    // Stream was empty. No point in parsing.
                    forecastJsonStr = null;
                }
                forecastJsonStr = buffer.toString();
            } catch (IOException e) {
                Log.e("ForecastFragment", "Error ", e);
                // If the code didn't successfully get the weather data, there's no point in attemping
                // to parse it.
                forecastJsonStr = null;
            } finally {
                if (urlConnection != null) {
                    urlConnection.disconnect();
                }
                if (reader != null) {
                    try {
                        reader.close();
                    } catch (final IOException e) {
                        Log.e("ForecastFragment", "Error closing stream", e);
                    }
                }
            }
        }
    }
Android Studio complains that I'm not actually overriding the function. I think it has something to do with the return value, but I don't quite understand the documentation for AsycTask. For doInBackground, it says the return is "A result, defined by the subclass of this task." The network code was given to me, and it doesn't return anything, so I figured the return would be void. What am I not getting here?

hooah
Feb 6, 2006
WTF?
Ok, I changed the inheritance to public class FetchWeatherTask extends AsyncTask<String, Void, Void>, but I don't understand what I need to change in the function signature. I thought (Params... params) meant that you could have a variable number of parameters, all of the same type. Since I put String as the Params generic, why doesn't String something work as the parameter for doInBackground?

hooah
Feb 6, 2006
WTF?
Great, that did it! Now I know about an array of parameters in Java.

hooah
Feb 6, 2006
WTF?
Oops, missed that Android Studio is now complaining about a missing return statement for protected Void doInBackground(String... params). Why is that?

hooah
Feb 6, 2006
WTF?

carry on then posted:

Lowercase v. Void is not a reserved word so it's expecting a Void object to be returned.

Ah, ok. Sorry I'm stupid; Java's my first second language, so I get tripped up on little differences like what's capitalized.

Or not. I did that for the method signature, but then it complains on the signature about attempting to use an incompatible return type. I changed the generics to lower-case void, and that made the signature fine, but now I get an error on the inheritance line with the voids saying they're an illegal type.

hooah fucked around with this message at 18:05 on Dec 17, 2014

hooah
Feb 6, 2006
WTF?
Right, I tried that:
Java code:
public class FetchWeatherTask extends AsyncTask<String, Void, Void> {

        @Override
        protected void doInBackground(String... params) {
and Android Studio underlines "void" in the signature and says "attempting to use incompatible return type".

hooah
Feb 6, 2006
WTF?
Oh, fantastic, return null; worked. That is some weird workaround poo poo, you ain't kidding. Thank you! Now I can continue to shoehorn Java learning in as I do this Android app course.

hooah
Feb 6, 2006
WTF?
I'm trying to build and run jMAVSim. When I tried to build the project in IntellliJ IDEA under Java 1.8.0_31, I get these errors:

quote:

F:\jMAVSim\jMAVlib\src\me\drton\jmavlib\conversion\RotationConversion.java
Error:(3, 23) java: cannot find symbol
symbol: class Matrix
location: package org.la4j.matrix
Error:(13, 19) java: cannot find symbol
symbol: class Matrix
location: class me.drton.jmavlib.conversion.RotationConversion
Error:(14, 9) java: cannot find symbol
symbol: class Matrix
location: class me.drton.jmavlib.conversion.RotationConversion
F:\jMAVSim\src\me\drton\jmavsim\SerialMAVLinkPort.java
Error:(80, 18) java: constructor MAVLinkStream in class me.drton.jmavlib.mavlink.MAVLinkStream cannot be applied to given types;
required: me.drton.jmavlib.mavlink.MAVLinkSchema,java.nio.channels.ByteChannel
found: me.drton.jmavlib.mavlink.MAVLinkSchema
reason: actual and formal argument lists differ in length
Error:(102, 23) java: method write in class me.drton.jmavlib.mavlink.MAVLinkStream cannot be applied to given types;
required: me.drton.jmavlib.mavlink.MAVLinkMessage
found: me.drton.jmavlib.mavlink.MAVLinkMessage,java.nio.channels.ByteChannel
reason: actual and formal argument lists differ in length
Error:(114, 29) java: method read in class me.drton.jmavlib.mavlink.MAVLinkStream cannot be applied to given types;
required: no arguments
found: java.nio.channels.ByteChannel
reason: actual and formal argument lists differ in length
F:\jMAVSim\src\me\drton\jmavsim\UDPMavLinkPort.java
Error:(32, 18) java: constructor MAVLinkStream in class me.drton.jmavlib.mavlink.MAVLinkStream cannot be applied to given types;
required: me.drton.jmavlib.mavlink.MAVLinkSchema,java.nio.channels.ByteChannel
found: me.drton.jmavlib.mavlink.MAVLinkSchema
reason: actual and formal argument lists differ in length
Error:(51, 42) java: 'void' type not allowed here
Error:(66, 29) java: method read in class me.drton.jmavlib.mavlink.MAVLinkStream cannot be applied to given types;
required: no arguments
found: java.nio.ByteBuffer
reason: actual and formal argument lists differ in length
F:\jMAVSim\la4j\src\main\java\org\la4j\matrix\MatrixFactory.java
Information:java: Some input files use unchecked or unsafe operations.
Information:java: Recompile with -Xlint:unchecked for details.

I tried "fixing" what the IDE didn't like by changing, adding (existing objects), or removing arguments and in one case changing an import statement ("import org.la4j.matrix.Matrix;" to "import org.la4j.Matrix;"). That allowed the project to build, but I can't find the jar file anywhere. First of all, were the changes I made appropriate? If not, what should have been done? If I'm ok through the build step, what do I need to do to generate a jar file?

hooah
Feb 6, 2006
WTF?

Sedro posted:

Did you git clone --recurse-submodules ?

I did not, since I didn't know about that command. Did that and ant ran fine. However, I can't run it; when I try from the command line I get the message "Could not find or load main class".

hooah fucked around with this message at 00:41 on Mar 9, 2015

hooah
Feb 6, 2006
WTF?
How the hell do I get a jar GUI to actually be responsive when I run it on Windows 8.1? I didn't make the file, so I can't really edit it (Stanford's NER tagger, for the record). It starts up OK and I can click a menu, but as soon as it opens that menu, nothing else responds except the close button.

hooah
Feb 6, 2006
WTF?
Yeah, I can run it fine on the school's server (Windows Server 2012, I believe).

hooah
Feb 6, 2006
WTF?

carry on then posted:

You could try launching it from the command line and seeing what gets printed when you click the menu, that might give you some insight.

Nothing is printed. It seems to fork the command, since the prompt looks ready to accept another command.

quote:

Other than that the only thing to check is that you have the right version of the JRE (I see the software you're using requires Java 8,) and that you have the latest updates for it from Oracle.

java -version returns 1.8.0_45, which is Java 8, correct?

quote:

Also, it's kind of a one-in-a-million chance, but why not try deleting your copy and redownloading it? Occasionally things do get corrupted which is why some people provide the MD5 hash of their binaries so you can be absolutely sure no bits got flipped.

I tried this, too, and no luck.

hooah
Feb 6, 2006
WTF?

Zaphod42 posted:

Can you run other Java JARs okay? Something sounds wrong with your JRE.

I'm not sure; I don't think I have any other JARs just sitting around. Do you have an example?

hooah
Feb 6, 2006
WTF?
That works fine until I open a secondary dialog. The Open dialog box was completely empty and unresponsive, and the rest of the program was unresponsive after closing that window. I tried Options, which I was able to see the first time I tried it, but just tried again and got a blank window. Sounds like my JRE is hosed up, but I feel like I've reinstalled it in the past for this same problem. Is there a good set of instructions for "really, do a full clean uninstall" reinstallation anywhere?

hooah
Feb 6, 2006
WTF?
Just reinstalled, similar behavior, but I see the content of secondary windows more often.

hooah
Feb 6, 2006
WTF?

hooah posted:

Just reinstalled, similar behavior, but I see the content of secondary windows more often.

No further suggestions to make JARs run properly?

hooah
Feb 6, 2006
WTF?

carry on then posted:

It's pretty clear at this point that you've got something wrong with your JRE or underlying operating system. I mean, you could download the source for that Portecle and try to run it and see what's happening when it freezes, but at this point I'd start looking for alternate ways to use the software (a VM, maybe? Or if your school offers a remote desktop session, just use that for your assignment.) Unfortunately, you may not be able to see a full resolution of the problem without reinstalling your OS.

Yeah, I ended up running the thing over RDP to a school machine. loving Java.

hooah
Feb 6, 2006
WTF?
Alright, I'll try to give more detail. I did use Revo when I uninstalled the existing Java. However, when I reinstalled, the installer found an installation of Java 7 that Revo was apparently unaware of. The Java installer removed the outdated version, then installed the new one. I am still unable to have a JAR GUI (either the Stanford NER program or the previously-mentioned portecle) be responsive beyond one mouse click.

I'm sorry if I haven't satisfied your specificity requirements; I'm pretty busy at the end of the semester, and don't currently have a lot of time for super-detailed troubleshooting. I was just responding to what was asked.

hooah
Feb 6, 2006
WTF?

Sedro posted:

Get a JVM stack dump using jstack or jvisualvm

Ok, here's the stack dump from jstack:

pre:
Attaching to remote server Files\Java\jdk1.8.0_31\bin\jstack.exe  1390464, please wait...
Error attaching to remote server: java.net.MalformedURLException: invalid URL String: //Files\Java\jdk1.8.0_31\bin\jstac
k.exe  1390464/SARemoteDebugger
sun.jvm.hotspot.debugger.DebuggerException: java.net.MalformedURLException: invalid URL String: //Files\Java\jdk1.8.0_31
\bin\jstack.exe  1390464/SARemoteDebugger
        at sun.jvm.hotspot.RMIHelper.lookup(RMIHelper.java:115)
        at sun.jvm.hotspot.HotSpotAgent.connectRemoteDebugger(HotSpotAgent.java:517)
        at sun.jvm.hotspot.HotSpotAgent.setupDebugger(HotSpotAgent.java:374)
        at sun.jvm.hotspot.HotSpotAgent.go(HotSpotAgent.java:304)
        at sun.jvm.hotspot.HotSpotAgent.attach(HotSpotAgent.java:183)
        at sun.jvm.hotspot.tools.Tool.start(Tool.java:196)
        at sun.jvm.hotspot.tools.Tool.execute(Tool.java:118)
        at sun.jvm.hotspot.tools.JStack.main(JStack.java:92)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:483)
        at sun.tools.jstack.JStack.runJStackTool(JStack.java:140)
        at sun.tools.jstack.JStack.main(JStack.java:106)
Caused by: java.net.MalformedURLException: invalid URL String: //Files\Java\jdk1.8.0_31\bin\jstack.exe  1390464/SARemote
Debugger
        at java.rmi.Naming.parseURL(Naming.java:243)
        at java.rmi.Naming.lookup(Naming.java:96)
        at sun.jvm.hotspot.RMIHelper.lookup(RMIHelper.java:113)
        ... 13 more
Caused by: java.net.URISyntaxException: Illegal character in authority at index 2: //Files\Java\jdk1.8.0_31\bin\jstack.e
xe  1390464/SARemoteDebugger
        at java.net.URI$Parser.fail(URI.java:2848)
        at java.net.URI$Parser.parseAuthority(URI.java:3186)
        at java.net.URI$Parser.parseHierarchical(URI.java:3097)
        at java.net.URI$Parser.parse(URI.java:3063)
        at java.net.URI.<init>(URI.java:588)
        at java.rmi.Naming.intParseURL(Naming.java:273)
        at java.rmi.Naming.parseURL(Naming.java:237)
        ... 15 more
Anything else I need to provide?

hooah
Feb 6, 2006
WTF?

Jabor posted:

This looks wonky. What did you type into the command prompt to actually run jstack?

After changing to the jdk \bin directory, "jstack.exe [PID]". I had done that after clicking on a menu. Here's a dump from just after starting the jar:
pre:
C:\Program Files\Java\jdk1.8.0_31\bin>jstack.exe 1394468
2015-05-09 08:19:39
Full thread dump Java HotSpot(TM) 64-Bit Server VM (25.45-b02 mixed mode):

"D3D Screen Updater" #22 daemon prio=7 os_prio=1 tid=0x0000000018840000 nid=0x154520 in Obj
0]
   java.lang.Thread.State: TIMED_WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        - waiting on <0x00000000e15e7fb8> (a java.lang.Object)
        at sun.java2d.d3d.D3DScreenUpdateManager.run(Unknown Source)
        - locked <0x00000000e15e7fb8> (a java.lang.Object)
        at java.lang.Thread.run(Unknown Source)

"TimerQueue" #20 daemon prio=5 os_prio=0 tid=0x00000000187b5800 nid=0x1545cc waiting on con
   java.lang.Thread.State: WAITING (parking)
        at sun.misc.Unsafe.park(Native Method)
        - parking to wait for  <0x00000000e15e0a80> (a java.util.concurrent.locks.AbstractQ
ject)
        at java.util.concurrent.locks.LockSupport.park(Unknown Source)
        at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(Unkn
        at java.util.concurrent.DelayQueue.take(Unknown Source)
        at javax.swing.TimerQueue.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)

"Swing-Shell" #18 daemon prio=6 os_prio=0 tid=0x0000000018721000 nid=0x1547b8 waiting on co
   java.lang.Thread.State: WAITING (parking)
        at sun.misc.Unsafe.park(Native Method)
        - parking to wait for  <0x00000000e1394df0> (a java.util.concurrent.locks.AbstractQ
ject)
        at java.util.concurrent.locks.LockSupport.park(Unknown Source)
        at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(Unkn
        at java.util.concurrent.LinkedBlockingQueue.take(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor.getTask(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at sun.awt.shell.Win32ShellFolderManager2$ComInvoker$3.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)

"DestroyJavaVM" #15 prio=5 os_prio=0 tid=0x0000000001e30800 nid=0x15478c waiting on conditi
   java.lang.Thread.State: RUNNABLE

"AWT-EventQueue-0" #14 prio=6 os_prio=0 tid=0x0000000017368000 nid=0x154240 waiting on cond
   java.lang.Thread.State: WAITING (parking)
        at sun.misc.Unsafe.park(Native Method)
        - parking to wait for  <0x00000000e0ff5c10> (a java.util.concurrent.locks.AbstractQ
ject)
        at java.util.concurrent.locks.LockSupport.park(Unknown Source)
        at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(Unkn
        at java.awt.EventQueue.getNextEvent(Unknown Source)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
        at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.run(Unknown Source)

"AWT-Windows" #12 daemon prio=6 os_prio=0 tid=0x0000000017367800 nid=0x1545f4 runnable [0x0
   java.lang.Thread.State: RUNNABLE
        at sun.awt.windows.WToolkit.eventLoop(Native Method)
        at sun.awt.windows.WToolkit.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)

"AWT-Shutdown" #11 prio=5 os_prio=0 tid=0x000000001730f000 nid=0x1545f8 in Object.wait() [0
   java.lang.Thread.State: WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        - waiting on <0x00000000e0ff2050> (a java.lang.Object)
        at java.lang.Object.wait(Unknown Source)
        at sun.awt.AWTAutoShutdown.run(Unknown Source)
        - locked <0x00000000e0ff2050> (a java.lang.Object)
        at java.lang.Thread.run(Unknown Source)

"Java2D Disposer" #10 daemon prio=10 os_prio=2 tid=0x000000001730e800 nid=0x1509b8 in Objec

   java.lang.Thread.State: WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        - waiting on <0x00000000e0fec898> (a java.lang.ref.ReferenceQueue$Lock)
        at java.lang.ref.ReferenceQueue.remove(Unknown Source)
        - locked <0x00000000e0fec898> (a java.lang.ref.ReferenceQueue$Lock)
        at java.lang.ref.ReferenceQueue.remove(Unknown Source)
        at sun.java2d.Disposer.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)

"Service Thread" #9 daemon prio=9 os_prio=0 tid=0x00000000157ce800 nid=0x1543f8 runnable [0
   java.lang.Thread.State: RUNNABLE

"C1 CompilerThread2" #8 daemon prio=9 os_prio=2 tid=0x0000000015772800 nid=0x154408 waiting
0000]
   java.lang.Thread.State: RUNNABLE

"C2 CompilerThread1" #7 daemon prio=9 os_prio=2 tid=0x0000000015771800 nid=0x154040 waiting
0000]
   java.lang.Thread.State: RUNNABLE

"C2 CompilerThread0" #6 daemon prio=9 os_prio=2 tid=0x000000001576c800 nid=0x153dcc waiting
0000]
   java.lang.Thread.State: RUNNABLE

"Attach Listener" #5 daemon prio=5 os_prio=2 tid=0x000000001576a800 nid=0x1547ac waiting on
0]
   java.lang.Thread.State: RUNNABLE

"Signal Dispatcher" #4 daemon prio=9 os_prio=2 tid=0x0000000015769000 nid=0x1544b8 runnable
   java.lang.Thread.State: RUNNABLE

"Finalizer" #3 daemon prio=8 os_prio=1 tid=0x0000000001f25800 nid=0x154780 in Object.wait()
   java.lang.Thread.State: WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        - waiting on <0x00000000e0c06f58> (a java.lang.ref.ReferenceQueue$Lock)
        at java.lang.ref.ReferenceQueue.remove(Unknown Source)
        - locked <0x00000000e0c06f58> (a java.lang.ref.ReferenceQueue$Lock)
        at java.lang.ref.ReferenceQueue.remove(Unknown Source)
        at java.lang.ref.Finalizer$FinalizerThread.run(Unknown Source)

"Reference Handler" #2 daemon prio=10 os_prio=2 tid=0x0000000001f1d000 nid=0x1547c0 in Obje
]
   java.lang.Thread.State: WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        - waiting on <0x00000000e0c06998> (a java.lang.ref.Reference$Lock)
        at java.lang.Object.wait(Unknown Source)
        at java.lang.ref.Reference$ReferenceHandler.run(Unknown Source)
        - locked <0x00000000e0c06998> (a java.lang.ref.Reference$Lock)

"VM Thread" os_prio=2 tid=0x0000000015737800 nid=0x154410 runnable

"GC task thread#0 (ParallelGC)" os_prio=0 tid=0x0000000001e46800 nid=0x154790 runnable

"GC task thread#1 (ParallelGC)" os_prio=0 tid=0x0000000001e48000 nid=0x15476c runnable

"GC task thread#2 (ParallelGC)" os_prio=0 tid=0x0000000001e4a000 nid=0x154788 runnable

"GC task thread#3 (ParallelGC)" os_prio=0 tid=0x0000000001e4c000 nid=0x1547c4 runnable

"VM Periodic Task Thread" os_prio=2 tid=0x000000001701d800 nid=0x154008 waiting on conditio

JNI global references: 489

Adbot
ADBOT LOVES YOU

hooah
Feb 6, 2006
WTF?
Sure, but first, one thing that I'm unsure about is the process ID. I used Task Manager to get it, but all I could find was a PID for java.exe. Should that be the correct PID, or should I look for a different one?

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply