Despite creating file association, file will not open in my Application - java

In my registry, for the extension '.conf' I made the (Default) value point to the pathway of my App. However when I try clicking a file with the extension '.conf' the window asking the user to select a program still opens, rather than simply opening the app associated with the extension. Am I declaring something wrong?
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\.conf]
#="C:\\Users\\izhodzis\\workspace\\ConfCompiler\\src\\ConfCompiler.jar"
PS. The idea is that it will work on other peoples' computers. They shouldn't need to select "Always use the selected program to open this kind of file"

Your regedit should look something like this: PATH_TO_JAVAW -jar PATH_TO_CONFCOMPILER
"C:\\Program Files\\Java\\j2rex.y.z\\bin\\javaw.exe -jar C:\\Users\\izhodzis\\workspace\\ConfCompiler\\src\\ConfCompiler.jar"
That probably won't work but hopefully it would help you further.

Related

Using a JavaFX application as standard program for mp3 files

I'm working on a media player using JavaFX right now and I would like to set it as the standard program to open .mp3 files in the future.
I know how to change the standard program. But when the user double clicks a specific file and my program opens up how would I be able to get the path to the file the user clicked on?
Thanks in advance!
This is the way I made it work:
I exported my program from Eclipse. Then I opened an mp3 file using the program but I got an error message saying something like this: "Invalid Win-32 application".
Having used Launch4j before, I tried wrapping my file in an exe file, which made it work perfectly.
I don't know if you are able to set a jar file as a standard program in other OSs, but you can't in Windows, unfortunately. But at least the OS gives you the path to the file the user clicked on!
Thanks again to #James_D !

RCP exported EXE shows java console

I've created a very simple RCP application (essentially just a default view).
I then created a product file and Exported the product (as many online guides have demonstrated). However when I run the .exe file a java console is shown alongside my application splash screen. Is this normal behaviour? (I wasn't expecting a console to show as it's been exported/deployed).
Current research suggests I should:
run with javaw.exe
use another installer
Any further insight or advice would be appreciated.
Look in the .product file at the 'Program Arguments' (on the 'Launching' tab in the editor). Remove the '-consoleLog' argument.

Java .jar "Open With" Windows Explorer continually spawns Explorer processes

Wondering if anyone can tell me why trying to open a .jar file with Win7 Explorer ("Open With" C:\Windows\explorer.exe) would cause the computer to continually create (over 200+ in a couple seconds) explorer processes?
Thanks!
Maybe do you want to view the contents of the jar? Take a look to this page. Or try with what is written on this page if you want to execute the jar without the command shell.
EDIT:
The problem of windows explorer is described in this page and in this too.
I'm wondering why you are trying to open a jar file using Windows Explorer...change the properties...set it to run with java.exe....everything should be fine...and coming to the 200+ question...unless it is a virus or something, it should not behave in such a way...strange to see that happen....try opening other jars in a similar way...you'll get to know the problem and the eventual solution...
Had the same problem with opening JAR files.
From here(thanks Alberto Solano):https://social.technet.microsoft.com/Forums/windows/en-US/9237ca68-645c-4718-9a51-24788f312c4b/windows-7-hangs-when-opening-a-file-with-explorerexe?forum=w7itproperf
This works(thanks MVied):
Run Registry Editor
Browse to \HKEY_USERS\S-1-5-21-(random numbers with dashes)\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts(whatever file extension is broken, i.e. '.jpg')\
Delete the folder called 'UserChoice'

When trying to open a .java file from windows explorer I get a "No project found to open file in" error message

So, when I double click a file in windows explorer, Intellij fires up, but instead of just showing me the file I want to see, shows up the following message:
I think I get what it means: it means this given .java file isn't associated with an Intellij project.
That's actually true, but even so I'd like to be able to open the file and see it with syntax highlighting and such.
How to overcome this problem?
Thanks
It's a known limitation which we plan to address in the future versions to allow opening and editing individual files without project context.
Please watch/vote the related issue.
I don't think you can'tcan by default. I'm assuming you are opening downloaded files or such. What I would is create a project (Scrapbook for example is a good name) on desktop and I would put/download the file I want to see in the corresponding src folder. That way when I'm clicking it would open properly.
Most of the syntax highlight and such goodness of idea comes from a proper project setup (proper JDK paths, libraries, etc).

Changing System.in in eclipse to read from a file

This seems like kind of a silly question but is there a way to change the standard in in eclipse. If I was doing this from the windows console it would look like "java myprogram < stdin.txt"
I am using Eclipse 3.4 and I see a place to enter a file for stdin/stdout on the Common tab of a Java Application Run configuration. I am not exactly sure if it will work for stdin, but it is worth a try.
The way you do this in VS is to set the command line arguments when debugging to "< stdin.txt". Maybe the same will work in Eclipse? I'd check but I don't have it on this machine.
There is a (fairly ugly) solution, as pointed out in this comment
Since the mailing list archive I originally linked to seems to have disappeared, here is a copy of what was there (in turn copied from here):
The ability to redirect standard input to come from a file is OS dependent (actually it's a function of the OS's shell, in this case your DOS window). Eclipse doesn't directly support doing what you want, but achieving this is relatively simple to do.
In your project, right click and select New->File and name it streamit.bat. Select the new file, right click and Open With->Text editor. Enter the following line and save the file:
java %1 < %2
Now create a External tool launch configuration - from the Run menu go to Run->External tools->External tools... Select Program and hit New, then in the Location field, hit Browse workspace and select streamit.bat from your project. In the Working directory field, hit Browse workspace and select your project. In the Arguments field enter:
StreamClass input.txt
(this assumes input.txt is located in your project) Now hit Run. It'll launch streamit.bat, replacing %1 and %2 with the arguments specified, and the results will be displayed in the Console view. You can repeat this run by clicking the Run button with the red toolbox on the toolbar.

Categories

Resources