RadicalTruthHF

Compile + Run stuff

Jul 14th, 2012
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.34 KB | None | 0 0
  1. import os
  2. import sys
  3.  
  4. """Made by Radical Truth on HF."""
  5.  
  6.  
  7. choice = raw_input("What kind of file would you like to compile/run? " +
  8.         "If the extension is .java, type 1. If the extension is .class, " +
  9.         "type 2. If the extension is .py, type 3. More filetypes will be " +
  10.         "added soon.")
  11.  
  12. def javaNotice():
  13.     print "NOTE: This program assumes you have bin inside your PATH.\
  14.         If this is not so, use Google to find out how to put \
  15.         Java's bin in your PATH."
  16.  
  17. def pythonNotice():
  18.     print "NOTE: This program assumes you have Python inside your PATH.\
  19.         If this is not so, use Google to find out how to put Python in \
  20.         your PATH."
  21.  
  22.  
  23. if choice = '1'
  24.     javaNotice()
  25.  
  26.  
  27.     file_path = raw_input("Enter file path (WITH \".java\"): \n")
  28.     file_name = raw_input("Enter file name (WITHOUT \".java\"): \n")
  29.     os.system("javac " + file_path)
  30.     os.system("java " + file_name)
  31.  
  32.  
  33.  
  34.  
  35. if choice = '2'
  36.     javaNotice()
  37.  
  38.  
  39.     file_path = raw_input("Enter file path, without file name. \n" +
  40.         "hint: C:\\Users\\Name\\Desktop\\Projects")
  41.     file_name = raw_input("Enter file name, without .class extension. \n")
  42.  
  43.     os.system("cd " + file_path)
  44.     os.system("java " + file_name)
  45.  
  46.  
  47.  
  48.  
  49. if choice = '3'
  50.     pythonNotice()
  51.  
  52.     file_path = raw_input("Enter file path, with file name and extension. \n")
  53.  
  54.     os.system("python " + file_path)
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61. sys.exit
Advertisement
Add Comment
Please, Sign In to add comment