Running simple website through Jar file [closed] - java

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 9 years ago.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Improve this question
I am trying to run simple static website through Jar file but not having too much luck.
The reason I want to run the website through Jar because I don't want end users to access my pages directly. For example, they should not have access to index.html page directly without actually starting my program which is built using java swing.
Things I tried:
Jar application works if I am running on the same machine where I created Jar using Eclipse because index.html page is fetching the page from local directory. which i know is wrong.
If I try using different laptop or desktop then my swing application does not open any kind of index.html through my browser.
So any suggestions?
Also, I was using Desktop.open(), Desktop.browse, getClass().getResources().getURL() .. stuff that I seen on other pages.

You need to copy your data or use a server like tomcat, jboss etc.

Related

Would you typically compile a java file before sharing it? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 3 years ago.
Improve this question
I'm new to Java and new to compiling. What are the pro's/con's of sharing java code that is compiled vs not compiled?
Normally you'd put the code in a source repository of some kind and that's how you share the code.
If you want the share the finished product, well, if it's a standalone app, build it into a full executable entity (using build systems, launch4j, etc – this gets a bit complicated to produce a fully stand-alone thing any end user with no knowledge of programming and nothing installed can just install and use) – and share that. If it's a webapp, host it someplace and share the URL.

How to download images from html page that uses javascript [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I do program to parse html pages and store images. But I ran into a problem. This page is dynamically generated by JavaScript, it means when I download the source code of the page and there are links to pictures. Can you please advise how to bypass it? Alternatively, some příkalad to be in Java. thank you
Downloading page:
http://www.lide.cz/detail/j0YbgS6Xp7AoMAOP
That is not as easy as it seems to be at first glance. You need a headless browser engine like PhantomJS or the like that runs the Javascript and returns you the generated HTML.
See this answer to get more information on that topic.

Playframework Render Javadocs [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I need to render an entire javadocs filestructure which is in plain html.
I need this to render the files using permissions. The user needs to be logged in in order to view the files.
I got a folder with .js .html and some other folders as well. I need these to be viewed by a user, but only if this user is logged in.
How do I allow Play! to return a set of these specific files, without having to modify them?
Googled quite a lot but to no avail.
Thanks in advance
You would have to create your own version of the assets controller that will enforce the auth-requirement, you could probably get it to work by just wrapping the built in Assets controller. If the javadoc is not packaged with play you could take a look at the ExternalAssets controller which can server arbitrary files from the filesystem.
If you do not already have a play app that you are including this in it would probably be easier to do this with a webserver, apache would for example allow you to do this with only configuration.

Is maven necessary to create web sockets in java? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
As i m new to the web sockets i want to clarify that is there any simple methods to create web sockets in java without using maven.
please help me friends.
There might be different ways to create web sockets,but if your question is whether you can create web sockets without including maven as a build ,then the answer is yes.
but let me clarify maven is not the one which you need to create web sockets,its just a build tool.
For better understanding ,go through following link
http://www.mkyong.com/tutorials/maven-tutorials/

where should I put the jar file? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
If I create a java program in java editor like notepad++ and I need to some external jar file for running this program then where should I put it for running this program.
It doesn't matter how or where you create the program. Required jars should be on the classpath.
If you are using command line to execute the program you can use
java -classpath pathOfRequiredJars PathToClass
It is a good practice to add all your .jar libraries inside a subfolder of the project folder, like MyProject\lib. It doesn't matter that you use one editor or another, you will have to specify the classpath to these required jars when running your project.

Categories