JAR does not work when opened from a file - intellij-idea

I´m trying to create JAR from IntelliJ project including some external libraries. Finally, I´ve managed to get JAR working in IntelliJ - the whole application loads and works perfectly. When I try to open it from the file, I get only a blank window opening.
I´ve tried every manual and tutorial I found here, on youtube and all over the internet but noone seems to have the same issue.
Any help will be much appreciated!
This is how the Project Structure section looks like
Project Structure
SOLVED with InputStream is = getClass().getResourceAsStream("clock.png");
the only way textures will load in JAR.

Related

Getting set up with intelliJ IDEA

Really basic question here but this has always stopped me from using any JetBrains product, but here I am trying once again. I also have the same issues with CLion but that will be for another time and hopefully I can figure it out based on some feedback from this post.
I need to set up my environment in IntelliJ. Nothing special. No build tools. Currently I just run my school projects using
javac Main.java
java Main
This has gotten me so far but I really want to use IntelliJ tools to their full capacity.
I want to be able to set break points and step in and out of my code in their debugger and all the other nice tools that come with running my code through IntelliJ
Every get started tutorial that I have watched on YouTube or from JetBrains themselves already has a basic build configuration set up to run your basic "Hello World" application and that is what I think I need. Just compile my java files into classes and run/debug them.
This is what the run configuration icon in the IDE should look like
And this is what mine currently looks like
I have set many different JDKs to go along with my projects but none of them seem to get the tools I need set up in the IDE. I have even let IntelliJ download one for me and set it up itself to see if maybe I downloaded and installed it wrong and IntelliJ maybe wasn't recognizing it.
This picture below is showing the project structure for an application that I let IntelliJ download a JDK for and set it up itself
So if someone could help me that would be fantastic. Links to videos, blogs are welcome even though I know that isn't the convention on this forum but I think that would be sufficient for my situation. Thanks in advance!
---Update---
I have found that if I create a project in IntelliJ that I get all the default configurations that I need. The problem is when I need to get a project from VCS that I am not getting any of the configurations that I need to run/debug my program in IntelliJ.
The easiest solution here would be to click the green play button next to your main method, on the left where line numbers are displayed.
Intellij will configure a default java run configuration for you. It will be displayed in the menu for later use, like in the screenshot you posted, after your first run.
You can also create one using the to menu: Run > Edit run configuration to add some more options like arguments, environment variables (that only apply for the run config), etc.
A good starting point would be the Intellij help page on that topic. This help pages are always a good start and you find comprehensible instructions there on every topic.
Another good resource is the Intellij by JetBrains YouTube channel. This video about debugging shows both ways I described above. They have lots of quick tutorials about lot of features, like code generation or build tools. Check out the channel's playlists for specific topics.
Update
The problem with the already created project is that the default/ folder is not marked as source folder. You can do that by File > 'Project Structure...' and set the default/ folder as Sources:
The cause for intellij not recognizing this is because you didn't use a folder structure like the one of maven.
For source code:
src/main/java
src/main/resources
and for tests:
src/test/java
src/test/resources
If you set it up that way IntelliJ everything works as expected. I created a pull request to your repo. If you check out the branch, IntelliJ will setup everything correctly automatically.

Why cannot find declaration to go to in IntelliJ Idea?

I have a code in go, and I am using IntelliJIdea for development. It used to work fine, but since the time I have changed the folder where the code used to be, IntelliJ has been behaving in a weird manner. It shows me a lot of unable to find declaration to go to errors. After changing the folder where my project used to be, I changed the GOPATH and imported from the new directory once again.
I am attaching the screenshot as that will be better for understanding.
See the conductor.Start(). This function is right there in the package app. But it can't find this.
PS: I have tried importing the project from scratch and invalidating and restarting multiple times, but that didn't help.
I'm using Gogland, which is also a JetBrains IDE, but I also had a problem with symbols not getting resolved.
I fixed it by deleting the project's index file.
Close the IDE.
In your project directory, find a directory named ".idea".
Delete all files with the extension ".iml" in that directory.
Restart the IDE.
The project should get reindexed and symbols will be resolved.
https://www.jetbrains.org/intellij/sdk/docs/basics/project_structure.html?search=.iml
For my case, Intellij didn't have Rust installed. I found that out while trying to create a new project (it had JAVA and other language support). As soon as I installed Rust, it worked.
For my case, I have 2 virtual environments, and I found that I did not set the correct environment in Pycharm. The environment I used did not include these packages. After I changed the environment, everything goes well.

Web API Help page not showing XML

I have a Web API project in which I removed by hand Areas folder few months ago when we started development. Now after everything is finished I want to add API help pages but it is not working as expected.
I installed nuget package for help pages.
I uncommented line in HelpPageConfig.cs
I checked Generate documentation file (to App_Data folder)
When I open http://localhost:51665/help I get this: (No methods are shown)
Any idea what could be wrong? If I start new project from scratch everything works properly.
I suppose you've setup your project in two steps:
You should choose Build tab in API project Properties and set up XML Documentation file in Output section. For example: App_Data\XmlDocument.xml
Then you can updateHelpPageConfig.cs in method Register... in my case
config.SetDocumentationProvider(new XmlDocumentationProvider(HttpContext.Current.Server.MapPath("~/App_Data/XmlDocument.xml")));
When your project is in compilation process, take a look in output window, whether documentation is really generated.
Try to use older version of ASP.NET Help pages (version 5.2.2 works for me).
Install-Package Microsoft.AspNet.WebApi.HelpPage -Version 5.2.2

Netbeans 7.2 not reflects modification on html, jsp pages

Recently i moved from netbeans 6.9 to Netbeans 7.2, while working on 6.9, i have handy functionality of after deployed my project if i do modifications in html or jsp pages i can see when i refresh the page in browser. But while using 7.2 it's not available, so each time i need to build, and deploy for changes get updated.
So i gotta few suggestions like
1)
Check->Compile on save in project properties
Uncheck->Deploy on save in project properties, but still it's not working.
Any idea what i have missed.
Thanks in advance.!
I must say this scenario works fine for me - I don't see any problem. What kind of project are you using - Ant-based or Maven-based? The best thing would be if you can file a P2 issue in the netbeans.org bug database, so we can investigate. Thank you.
This happened to me as well. I tried renaming the project to a new name not the project folder and re run. It worked for me. Try for yourself.
Nitin.

Codewarrior won't open .mcp project file

A colleague of mine has been working on a project in Codewarrior and I have come on board to assist.
When trying to open the .mcp project file that she has created (and is working fine on her codewarrior) I get the following error.
Similarly - when I try to open her workspace file, I get the following error.
Important to note, we are using the exact same versions of codewarrior and I am able to open and work with other codewarrior projects.
Anyone had this problem before?
This seemed to be caused by SVN interpreting this as a non-binary file. Problem was solved by exporting her codewarrior project to an XML file and then importing this to my machine, creating my own .mcp file.
Simple really - just putting an answer up in-case someone googles across this again.