File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed
Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change 1+ /*
2+ * jco.cpp
3+ * Java Class Opener
4+ * Simple portable app that opens Java classes using double click.
5+ * No need for cmd, typing java <class name> all the time.
6+ *
7+ * To use, simply associate your ".class" files with "jco.exe"
8+ *
9+ * (c) August 2016 Raymel Francisco
10+ */
11+ #include < iostream>
12+ #include < windows.h>
13+ #include < string>
14+
15+ using namespace std ;
16+
17+ int main (int argc, char ** args)
18+ {
19+ if ( argc > 1 ) {
20+
21+ string quo = string (" \" " );
22+ string path = string (args[1 ]);
23+ int path_len = path.length ();
24+ int name_start = path.find_last_of ( string (" \\ " ), path_len ) + 1 ;
25+ int name_end = path.find_last_of ( string (" ." ), path_len) - name_start;
26+ string class_name = path.substr ( name_start, name_end );
27+
28+ if ( system ( (" java " + quo + class_name + quo).c_str () ) == -1 )
29+ cout << " jco.exe failed." << endl;
30+ else
31+ cout << " jco.exe success." << endl;
32+
33+ } else {
34+ cout << " No input file." << endl;
35+ cout << " jco.exe failed." << endl;
36+ }
37+ system (" pause" );
38+ }
You can’t perform that action at this time.
0 commit comments