導航:首頁 > 專利知識 > java設置軟體使用期限

java設置軟體使用期限

發布時間:2021-05-07 01:49:57

❶ 你好,我想問一下怎麼用Java代碼限制軟體使用期限,能給詳細代碼么

獲取系統的當前時間,然後減去注冊時間 如果超過了你設定的期限時間就是過期了

❷ 怎樣給文件夾設置使用期限,有什麼軟體嗎

只有加密,
當然,有直接許可權整個磁碟的,
改文件夾許可權的沒見過

❸ JAVA編寫的軟體,求人修改一下使用時間期限!

做的不好,請樓主和各位多提意見!!

工具: eclipse

文件名: Editor.java

代碼:

import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.util.StringTokenizer;

import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.Timer;

public class Editor extends JFrame {

private JPanel jContentPane = null;
private JMenuBar jMenuBar = null;
private JMenu jMenu = null;
private JMenuItem jMenuItem = null;
private JMenuItem jMenuItem1 = null;
private JMenu jMenu1 = null;
private JMenuItem jMenuItem2 = null;
private JMenuItem jMenuItem3 = null;
private JTextArea jTextArea = null;
private JScrollPane jScrollPane = null;
private File openFile=null;
/**
* This is the default constructor
*/
public Editor() {
super();
initialize();
}

/**
* This method initializes this
*
* @ void
*/
private void initialize() {
this.setSize(300, 200);
this.setJMenuBar(getJMenuBar());
this.setContentPane(getJContentPane());
this.setTitle("JFrame");
}

/**
* This method initializes jContentPane
*
* @return javax.swing.JPanel
*/
private JPanel getJContentPane() {
if (jContentPane == null) {
jContentPane = new JPanel();
jContentPane.setLayout(new BorderLayout());
jContentPane.add(getJScrollPane(), java.awt.BorderLayout.CENTER);
}
return jContentPane;
}

/**
* This method initializes jJMenuBar
*
* @return javax.swing.JMenuBar
*/
public JMenuBar getJMenuBar() {
if (jMenuBar == null) {
jMenuBar = new JMenuBar();
jMenuBar.add(getJMenu());
jMenuBar.add(getJMenu1());
}
return jMenuBar;
}

/**
* This method initializes jMenu
*
* @return javax.swing.JMenu
*/
private JMenu getJMenu() {
if (jMenu == null) {
jMenu = new JMenu();
jMenu.setText("file");
jMenu.setBounds(new java.awt.Rectangle(0,0,35,35));
jMenu.add(getJMenuItem());
jMenu.add(getJMenuItem1());
}
return jMenu;
}

/**
* This method initializes jMenuItem
*
* @return javax.swing.JMenuItem
*/
private JMenuItem getJMenuItem() {
if (jMenuItem == null) {
jMenuItem = new JMenuItem();
jMenuItem.setText("open");
jMenuItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
openFile=new File(JOptionPane.showInputDialog(null,"請輸入有效的文件路徑","文件選擇",JOptionPane.INFORMATION_MESSAGE));
FileInputStream fileIS = null;
BufferedInputStream filePS=null;
byte[] fileCode;
if(openFile.isFile()){
try {
fileIS=new FileInputStream(openFile);
filePS=new BufferedInputStream(fileIS);
fileCode = new byte[fileIS.available()];
filePS.read(fileCode);
jTextArea.setText(new String(fileCode));
filePS.close();
fileIS.close();
jMenuItem1.setEnabled(true);
} catch (FileNotFoundException e1) {
e1.printStackTrace();
} catch (IOException e1) {
e1.printStackTrace();
}
} else{
JOptionPane.showMessageDialog(null,"打開文件路徑錯誤","錯誤",JOptionPane.ERROR_MESSAGE);
}

}
});
}
return jMenuItem;
}

/**
* This method initializes jMenuItem1
*
* @return javax.swing.JMenuItem
*/
private JMenuItem getJMenuItem1() {
if (jMenuItem1 == null) {
jMenuItem1 = new JMenuItem();
jMenuItem1.setText("save");
jMenuItem1.setEnabled(false);
jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
PrintStream filePS = null;
File saveFile=null;
String fileName = JOptionPane.showInputDialog("輸入保存文件的路徑(默認為原路徑)");
if(fileName.equals("") || fileName==null)saveFile = openFile;
else saveFile = new File(fileName);
if(saveFile.isFile()){
try {
filePS=new PrintStream(new FileOutputStream(openFile));
filePS.print(jTextArea.getText());
filePS.close();
} catch (FileNotFoundException e1) {
e1.printStackTrace();
} finally{
filePS.close();
}
} else {
JOptionPane.showMessageDialog(null,"保存文件路徑錯誤","錯誤",JOptionPane.ERROR_MESSAGE);
}
}
});
}
return jMenuItem1;
}

/**
* This method initializes jMenu1
*
* @return javax.swing.JMenu
*/
private JMenu getJMenu1() {
if (jMenu1 == null) {
jMenu1 = new JMenu();
jMenu1.setText("util");
jMenu1.add(getJMenuItem2());
jMenu1.add(getJMenuItem3());
}
return jMenu1;
}

/**
* This method initializes jMenuItem2
*
* @return javax.swing.JMenuItem
*/
private JMenuItem getJMenuItem2() {
if (jMenuItem2 == null) {
jMenuItem2 = new JMenuItem();
jMenuItem2.setText("count");
jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
JOptionPane.showMessageDialog(null,"當前文件的字元數:"+jTextArea.getText().length());
}
});
}
return jMenuItem2;
}

/**
* This method initializes jMenuItem3
*
* @return javax.swing.JMenuItem
*/
private JMenuItem getJMenuItem3() {
if (jMenuItem3 == null) {
jMenuItem3 = new JMenuItem();
jMenuItem3.setText("reverse");
jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
final StringTokenizer textTokenizer = new StringTokenizer(jTextArea.getText(),"\n");
final StringBuffer textBuffer = new StringBuffer(jTextArea.getText());

Timer replaceTimer = new Timer(100, new ActionListener() {
StringBuffer replaceBuffer = null;
int start = 0;
int end = 0;
public void actionPerformed(ActionEvent e) {
if(textTokenizer.hasMoreTokens()){
replaceBuffer = new StringBuffer(textTokenizer.nextToken());
end = textBuffer.indexOf("\n",end+1);
if(end<0) end = textBuffer.length();
start = end - replaceBuffer.length();
textBuffer.replace(start,end,replaceBuffer.reverse().toString());
jTextArea.setText(textBuffer.toString());
}
}
});
replaceTimer.start();
}
});
}
return jMenuItem3;
}

/**
* This method initializes jTextArea
*
* @return javax.swing.JTextArea
*/
private JTextArea getJTextArea() {
if (jTextArea == null) {
jTextArea = new JTextArea();
}
return jTextArea;
}

/**
* This method initializes jScrollPane
*
* @return javax.swing.JScrollPane
*/
private JScrollPane getJScrollPane() {
if (jScrollPane == null) {
jScrollPane = new JScrollPane();
jScrollPane.setViewportView(getJTextArea());
}
return jScrollPane;
}
public static void main(String args[]){
Editor editor = new Editor();
editor.setVisible(true);
}
}

說實話自己覺得做的並不好,不過事件都有了!

❹ 如何給javaweb程序添加使用期限製程序

下一個過濾器,設定一個過期時間就好了,到期filter直接返回不進入action

❺ java如何設置軟體試用期

java操作注冊表,寫入加密數據標記,用於計算試用期

❻ java web 開發如何控制使用期限及綁定伺服器mac

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.InetAddress;
import java.net.NetworkInterface;

/**
* 與系統相關的一些常用工具方法.
*
* @author lvbogun
* @version 1.0.0
*/
public class SystemTool {

/**
* 獲取當前操作系統名稱. return 操作系統名稱 例如:windows xp,linux 等.
*/
public static String getOSName() {
return System.getProperty("os.name").toLowerCase();
}

/**
* 獲取unix網卡的mac地址. 非windows的系統默認調用本方法獲取.
* 如果有特殊系統請繼續擴充新的取mac地址方法.
*
* @return mac地址
*/
public static String getUnixMACAddress() {
String mac = null;
BufferedReader bufferedReader = null;
Process process = null;
try {
// linux下的命令,一般取eth0作為本地主網卡
process = Runtime.getRuntime().exec("ifconfig eth0");
// 顯示信息中包含有mac地址信息
bufferedReader = new BufferedReader(new InputStreamReader(
process.getInputStream()));
String line = null;
int index = -1;
while ((line = bufferedReader.readLine()) != null) {
// 尋找標示字元串[hwaddr]
index = line.toLowerCase().indexOf("hwaddr");
if (index >= 0) {// 找到了
// 取出mac地址並去除2邊空格
mac = line.substring(index + "hwaddr".length() + 1).trim();
break;
}
}
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
if (bufferedReader != null) {
bufferedReader.close();
}
} catch (IOException e1) {
e1.printStackTrace();
}
bufferedReader = null;
process = null;
}
return mac;
}

/**
* 獲取widnows網卡的mac地址.
*
* @return mac地址
*/
public static String getWindowsMACAddress() {
String mac = null;
BufferedReader bufferedReader = null;
Process process = null;
try {
// windows下的命令,顯示信息中包含有mac地址信息
process = Runtime.getRuntime().exec("ipconfig /all");
bufferedReader = new BufferedReader(new InputStreamReader(
process.getInputStream()));
String line = null;
int index = -1;
while ((line = bufferedReader.readLine()) != null) {
System.out.println(line);
// 尋找標示字元串[physical
index = line.toLowerCase().indexOf("physical address");

if (index >= 0) {// 找到了
index = line.indexOf(":");// 尋找":"的位置
if (index >= 0) {
System.out.println(mac);
// 取出mac地址並去除2邊空格
mac = line.substring(index + 1).trim();
}
break;
}
}
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
if (bufferedReader != null) {
bufferedReader.close();
}
} catch (IOException e1) {
e1.printStackTrace();
}
bufferedReader = null;
process = null;
}

return mac;
}

/**
* windows 7 專用 獲取MAC地址
*
* @return
* @throws Exception
*/
public static String getMACAddress() throws Exception {

// 獲取本地IP對象
InetAddress ia = InetAddress.getLocalHost();
// 獲得網路介面對象(即網卡),並得到mac地址,mac地址存在於一個byte數組中。
byte[] mac = NetworkInterface.getByInetAddress(ia).getHardwareAddress();

// 下面代碼是把mac地址拼裝成String
StringBuffer sb = new StringBuffer();

for (int i = 0; i < mac.length; i++) {
if (i != 0) {
sb.append("-");
}
// mac[i] & 0xFF 是為了把byte轉化為正整數
String s = Integer.toHexString(mac[i] & 0xFF);
sb.append(s.length() == 1 ? 0 + s : s);
}

// 把字元串所有小寫字母改為大寫成為正規的mac地址並返回
return sb.toString().toUpperCase();
}
}

寫一個全局攔截的servlet,只要有請求的時候就調用這個類裡面的獲取mac地址的方法

String os = getOSName();
System.out.println(os);
if (os.equals("windows 7")) {
String mac = getMACAddress();
System.out.println(mac);
} else if (os.startsWith("windows")) {
// 本地是windows
String mac = getWindowsMACAddress();
System.out.println(mac);
} else {
// 本地是非windows系統 一般就是unix
String mac = getUnixMACAddress();
System.out.println(mac);
}

記得判斷一下是什麼系統

❼ 怎麼設置手機JAVA中軟體的時間

QQ和UC的時間就是你手機上的時間啊~

❽ java中如何用時間限製程序的執行

用線程等待可以限製程序的運行吧,如果是網頁,那麼就有clearTimeout()方法!

❾ java編寫的設置軟體的使用期限,例如使用30天就不能用,再想用就得輸入注冊碼,代碼全點,最好帶注釋

UltraEdit的嗎 我有用戶名和注冊碼 只不過好像不能升級了
Name:jialei_wy
Code:DSQOQ-OSPNA-JIHHK-TNVIO-ONFGK-EERGI-QOMRC-LQJAK

Name:jialei wy
Code:IEPQA-PCOJD-KHLFV-QJVHX-LEJMC-LGTR2-POQC3-CNJIV

Name:woshilaji
Code:JBOLD-GRUJO-KGQG3-SHTI6-GFCG3-JNJNP-MNXMD-NHKPQ

Name:fuck you
Code:QMPFM-INRPV-LLOK8-KGRLM-NJKFA-ELWOV-JKDPQ-PQJMP
你試試吧 反正我就是這樣注冊的

❿ 怎麼設置軟體的使用期限

設置軟體的使用期限方法如下:

程序開頭,
可以 GetFileTime 函數獲得 文件 建立的時間,或最後一次進入時間,或最後一次寫的時間為准。同 當前時間 作對比,算出時間差。
決定退出程序 或 跑程序。
GetFileTime 函數原型:
BOOL WINAPI GetFileTime( _In_ HANDLE hFile, _Out_opt_ LPFILETIME lpCreationTime, //文件建立的時間
_Out_opt_ LPFILETIME lpLastAccessTime, //最後一次進入時間 _Out_opt_ LPFILETIME lpLastWriteTime // 最後一次寫的時間
);
================
函數獲得 文件 的時間, 還有簡單辦法: 調 DOS 命令,
DIR /TC 程序名 或
DIR /TA 程序名 或
DIR /TW 程序名
來獲取 要的 3 個時間 之一。
用轉向到文件 的方法 system( "DIR /TC yuci.exe > abc.tmp");
再打開 abc.tmp 讀得 月日年時分 時間
11/06/2013 09:15 AM 34,521 yuci.exe
====
其它辦法很多,例如寫注冊表,寫文件。無非是記錄時間。
====
如果規定好使用日期,直接取當前時間 now = time (NULL);
比較 規定的 截止日期就可以了。

閱讀全文

與java設置軟體使用期限相關的資料

熱點內容
矛盾糾紛專項排查工作方案 瀏覽:103
法國發明家巴耶爾首創 瀏覽:561
油條機我愛發明 瀏覽:648
北京品源知識產權代理有限公司怎麼樣 瀏覽:240
著作權共同所有 瀏覽:778
二手途達轉讓 瀏覽:518
馬鞍山市花湖 瀏覽:480
永樂票務投訴 瀏覽:951
龍游智慧教育公共服務平台 瀏覽:186
興國工商局投訴電話 瀏覽:131
開封計程車投訴電話是多少 瀏覽:101
甘肅省基礎資源公共服務平台 瀏覽:612
馬鞍山父子身份 瀏覽:192
觀通杭州知識產權 瀏覽:10
認繳資本期限 瀏覽:855
黑龍江企業培訓師證書查詢 瀏覽:16
投資被騙報案有期限嗎 瀏覽:199
江蘇哲力知識產權招聘 瀏覽:186
溫州中小企業公共服務平台 瀏覽:54
英樹創造101投票 瀏覽:596