Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Template with examples not working #167

Open
Amoranemix opened this issue Sep 11, 2019 · 18 comments
Open

Template with examples not working #167

Amoranemix opened this issue Sep 11, 2019 · 18 comments

Comments

@Amoranemix
Copy link

Dear Github members,

I have started a course on Object Oriented programming in Java from UCSD via the Coursera platform and using Eclipse. (I am not familiar with Eclipse.) The exercises are based on Unfolding Maps. The teachers made a starter program that we are supposed to extend , but that doesn't work. The reason seems to be that their program uses the no longer supported AppletViewer.

I decided to try out Unfolding Maps myself in the hope of learning how to modify the starter program from UCSD such that it works. So I downloaded unfolding_app_template_with_examples_0.9.6.zip and imported it in Eclipse.

I tried JDK 1.8 and 12. Running the first example, SimpleMapApp failed with both. With JDK 12, running as Java applet, the following error message is displayed in the console :

Error: Could not find or load main class sun.applet.AppletViewer
Caused by: java.lang.ClassNotFoundException: sun.applet.AppletViewer

Running as Java application, an empty map window appears and the following message in the console :

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.jogamp.common.os.NativeLibrary$3 (file:/C:/Users/Frank%20Tavernier/Documents/School/eclipse-workspace/unfolding-app-template-with-examples/lib/gluegen-rt.jar) to method java.lang.ClassLoader.findLibrary(java.lang.String)
WARNING: Please consider reporting this to the maintainers of com.jogamp.common.os.NativeLibrary$3
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Unfolding Map v0.9.6
Using OpenGLMapDisplay with processing.opengl.PGraphics2D
server.org/tiles/bw-mapnik/10/549/336.png contains bad image data, or may not be an image.
The file http://a.www.toolserver.org/tiles/bw-mapnik/10/550/336.png contains bad image data, or may not be an image.
The file http://a.www.toolserver.org/tiles/bw-mapnik/10/549/335.png contains bad image data, or may not be an image.
The file http://a.www.toolserver.org/tiles/bw-mapnik/10/548/335.png contains bad image data, or may not be an image.
The file http://a.www.toolserver.org/tiles/bw-mapnik/10/548/336.png contains bad image data, or may not be an image.

+about 30 more similar lines

Can anyone explain how to make Unfolding Map work with Eclipse ?

@tillnagel
Copy link
Owner

@Amoranemix
Copy link
Author

Thanks for the suggestion.

I imported that new version. When running the first example, HellowUnfoldingWorld.java, with JDK 12, the console displays :

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.jogamp.common.os.NativeLibrary$3 (file:/C:/Users/Frank%20Tavernier/Documents/School/eclipse-workspace/unfolding-app-template-with-examples/lib/gluegen-rt.jar) to method java.lang.ClassLoader.findLibrary(java.lang.String)
WARNING: Please consider reporting this to the maintainers of com.jogamp.common.os.NativeLibrary$3
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Unfolding Map v0.9.92
Using OpenGLMapDisplay with processing.opengl.PGraphics2D

A window opens that displays black. I suspect it is supposed to display a map.

I haven't set the native library as instructed in the readme because I don't know how to do that.

@tillnagel
Copy link
Owner

Could you try Java 1.8 again?

@Amoranemix
Copy link
Author

Running HelloUnfoldingWorld.java under JDK 1.8 does the same, except that there are no warnings.

@tillnagel
Copy link
Owner

Is this HelloUnfoldingWorld example app the one from the distribution (i.e. from the Unfolding project), or one from the UCSD course? Please use the one from the distribution, or paste the code here.

@Amoranemix
Copy link
Author

It is an example from the package that I downloaded from the link you posted, version 0.9.92.

@tillnagel
Copy link
Owner

Ok, try out the SatelliteProviderMapApp to check if are able to see a map there.

Do you have a firewall prohibiting outgoing requests (the map tile images are requested from external servers).

@Amoranemix
Copy link
Author

No. Running SatelliteProviderMapApp.java also shows a window that is filled with black, both under JDK 1.8 and 12.

As firewalls I have a router and Windows 10 Defender. I have had no problems with them since I have this computer, that is since 14 months ago. Temporarily disabling the latter appears to make no difference.

@Amoranemix
Copy link
Author

If I understand correctly, there is no good way to use Unfolding Maps, at least not on my computer.

@tillnagel
Copy link
Owner

Yes, seems like it. I am very sorry for that, but haven't heard of your problem before.

Last question: Did you try other OpenGL examples (from Processing and/or JOGL)? Do any of these examples work on your computer?

@Amoranemix
Copy link
Author

No. How can I find these other OpenGL examples from Processing and/or OpenGL ?

@tillnagel
Copy link
Owner

See e.g. https://processing.org/tutorials/p3d/

@Amoranemix
Copy link
Author

I downloaded and installed Processing, which to my surprise was easy.
Then I pasted the following code in the top of 2 windows :

float x,y,z;
void setup() {
size(200,200,P3D);
x = width/2;
y = height/2;
z = 0;
}
void draw() {
translate(x,y,z);
rectMode(CENTER);
rect(0,0,100,100);
z++; // The rectangle moves forward as z increments.
}

Then I told Processing to run that code and to my surprise it did. A window with a changing rectangle appeared.
Warnings nor error messages appeared.

I tried using that code in Eclipse, but it tells me there are syntax errors in the code, like “P3D cannot be resolved to a variable”.

@r-hmn
Copy link

r-hmn commented Sep 26, 2019

Hi. I also used that version 0.9.92 yesterday, using IntellJ, using JDK 1.8.
the SimpleMapApp needed a small change wrt using size() to adhere to the processing.org 3.0 style.
I also set it to use JAVA2D instead of OPENGL.

package de.fhpotsdam.unfolding.examples;

import processing.core.PApplet;
import de.fhpotsdam.unfolding.UnfoldingMap;
import de.fhpotsdam.unfolding.geo.Location;
import de.fhpotsdam.unfolding.utils.MapUtils;

/**
 * An application with a basic interactive map. You can zoom and pan the map.
 */
public class SimpleMapApp extends PApplet {

	UnfoldingMap map;

	public void settings() {
		size(800, 600, JAVA2D);
	}

	public void setup() {
		map = new UnfoldingMap(this);
		map.zoomAndPanTo(10, new Location(52.5f, 13.4f));
		MapUtils.createDefaultEventDispatcher(this, map);
	}

	public void draw() {
		map.draw();
	}

	public static void main(String args[]) {
		PApplet.main(new String[] { SimpleMapApp.class.getName() });
	}
}

This does show up for me.

@Amoranemix
Copy link
Author

@ r-hmn:
Using Eclipse, in the code of SimpleMapApp.java of the unfolding-app-template-with-examples package I replaced P2D with JAVA2D. I don't understand the other modification you suggested.

With that single change the program creates an interactive map showing Berlin.

I went back to my original problem with the UCSDUnfoldingMaps package and managed to make that work too with JDK 1.8 and JAVA2D as argument for size() i.s.o. P2D.

In the console the comment “No OpenGL renderer. Using Java2DMapDisplay.” appears when either program is run.

@rochanofa
Copy link

I also tried to run the "SimpleMapApp" in Eclipse but this exception message always appears:

Exception in thread "main" java.lang.ExceptionInInitializerError
Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1
at processing.core.PApplet.(PApplet.java:118)

I have no experience with Eclipse. Could anyone tell me what should I modify?

@Isurumax26
Copy link

type following inside the HelloWorld class and Run as a Java application. It worked fine for me.

public static void main (String[] args) {

PApplet.main(module1.HelloWorld.class.getName());

}

@hiralshah265
Copy link

Ok, try out the SatelliteProviderMapApp to check if are able to see a map there.

Do you have a firewall prohibiting outgoing requests (the map tile images are requested from external servers).

Thanks for this. For me the issue is RESOLVED here. It was due to my firewall blocking the images being loaded.

@tillnagel tillnagel assigned tillnagel and unassigned tillnagel Aug 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants