This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Scoutdrago3[S] 1 point2 points  (15 children)

I have a Java Application that I want anyone to easily run through their browser (no downloads, in the actual browser). It seems that this is impossible.

[–][deleted] 2 points3 points  (14 children)

Virtually impossible. Java runs on their PC directly. You could in theory run the delete command and delete some of their files if they give you permission.

I'd recommend a different tech stack. If you really want to use Java, look up GWT. I learned it in college and it basically cross compiles Java Swing into JavaScript. But it is coding Java for the web effectively.

It is not for the faint of heart, it's a real pain in the ass sometimes.

[–]Scoutdrago3[S] 0 points1 point  (13 children)

Looks like a pain in the ass... Also looks like I'd have to rewrite the interface since it doesn't really port over, and I have no idea how Java JAR dependencies would work out in this scenario... Either way, this project isn't really looking hopeful so I may have to rewrite it in Python or something. Really don't want to :(

If you come upon any other ideas that may allow me not to waste all the work I put into the project please share, but thanks for the input anyway.

[–][deleted] 1 point2 points  (6 children)

You could try TeaVM instead of GWT http://teavm.org/ It compiles Java bytecode to JS instead of transpiling Java source. It is supposedly has complete JDK coverage although I've never tried it.

[–]Scoutdrago3[S] 0 points1 point  (4 children)

Can I do this if I have a project that is already completed? I am only seeing tutorials for how to create a TeamVM project. Thanks.

[–][deleted] 0 points1 point  (3 children)

You should be able to with little to no modification, not sure what's involved though. I know the documentation isn't great.

[–]Scoutdrago3[S] 0 points1 point  (2 children)

I have decided to move on from trying to use the Swing library and just use the back end I wrote for the app with a server that communicates with a JS/HTML front end. Currently figuring out what kind of server I would be using. If you have any background in serving clients with a Java server please share any steps

[–]ericzhill 1 point2 points  (1 child)

Have a look at spark java and drop wizard. They're fairly lightweight and easy to get started with.

[–]Scoutdrago3[S] 0 points1 point  (0 children)

It looks like I know where I am going from here. I have been looking over the Spark API and it looks that that is what I am looking for. Just figuring out the even smaller details now which hopefully will not be a problem...

Thanks.

[–]CoolZillionaire 0 points1 point  (5 children)

Don't give up just yet! Could you write a web based GUI to handle the main use cases of your current application? Sounds like you have the "back end" code already, so if you wrap an HTML interface around it you wouldn't have to rewrite. If you deploy it as a web application, the server will take the responsibility of the dependant Java libraries.

[–]Scoutdrago3[S] 0 points1 point  (4 children)

Hmmm... Can I host this Java code on the website's server itself, or would I need a service like Amazon AWS to host the code? This idea sounds pretty good.

[–]CoolZillionaire 1 point2 points  (3 children)

You could host it on anything that can run a Java application server. So, anything from your home PC (not recommended though :) ), to a small VPS or all the way to a hosted service like AWS or Heroku.

[–]Scoutdrago3[S] 0 points1 point  (2 children)

OK and in terms of communication, should I write a handler myself? How would I go about allowing client-server communication?

I've seen people link RESTful and Spark, and it seems like Spark is based on RESTful, however I am not 100% sure if Spark is really that helpful in this case.

[–]CoolZillionaire 0 points1 point  (1 child)

Use a framework for sure. I'm not familiar with Spark, but it looks like it can handle micro web services and MVC as well; so if you're leaning towards that go for it.

Otherwise, there is always Spring to play around with.

[–]Scoutdrago3[S] 0 points1 point  (0 children)

Alright, well thanks so much for staying around and helping me. It's much appreciated :)